qcc_kplugin.flow

Simulate, Results and Fab: the last three steps of the Quantcore Flow strip (G4 – G6).

ACTIONS fills the menu’s Simulate / Results / Fab submenus; simulate / results / fab are what the panel’s Flow buttons call.

  • Simulate (automatic): the components selected in KLayout are the subset (nothing selected: asks for the default subset or the whole chip). qcc sim auto runs in the background — subset, export, solve in a new non-graphical AEDT (never the one you have open), analyse — and the status bar shows its progress. KLayout stays usable; when it ends the layout is rebuilt so the Results tab shows the values.

  • Simulate (manual): the Simulate dialog’s Export the job only button (export_job) writes the job folder with a README (what to run, what to bring back); Import results… (a menu item) reads a solved job folder or a results.json back (format: qcc results template --format).

  • Results shows the latest values against the targets; Propose next revision previews old → new knob values (loop.feedback; 21 qubit classes with λ/4 or λ/2 readouts, through the generic surrogate in codesign.py; what it cannot tune is listed as Not tuned), and Apply writes them to design.json through the session (undo works) and rebuilds.

  • Fab writes the fab mask (qcc mask), the netlist (circuit.json), design.py (the drawn chip as a Designer script) and a PNG into one folder.

Everything slow runs as a qcc subprocess through qcc_kplugin.jobs (never in KLayout’s UI thread, never a modal dialog from a timer). The functions take wait=True for tests, which blocks until the job ended.

Attributes

Classes

FlowJob

A jobs.Job that shows its own progress (a status file the qcc command writes plus the AEDT progress

ProposalWindow

A non-modal window with a title, text and a Close button (results of background jobs: never modal from a timer).

ResultsDialog

Latest values against the targets (the sidecar's results: the same rows as the panel's Results tab), plus

SimJob

qcc sim auto, started detached so it outlives KLayout (see simrun). Its output goes to

Functions

aedt_path_too_long(job_dir) → bool

AEDT fails on Windows when its *.aedtresults folders pass 260 characters; the job folder name is repeated

apply_proposal(proposal, path[, wait])

Write a proposal's knobs to design.json through the session (one undo step) and rebuild.

ask_dir(title, start) → str | None

ask_file(title, start[, pattern]) → str | None

choose(title, text, choices[, checkbox])

A small modal question: one button per choice and Cancel. Returns (index, checked) or None. (An

export_job([wait, names, subset, folder, analysis, ...])

The Simulate dialog's Export the job only button: write the job folder (geometry, AEDT scripts, job.json,

fab([wait, folder, force])

Flow ▸ Fab: the fab mask (qcc mask, PDK fab layers, cheese and corner rounding), the netlist (circuit.json),

import_results([wait, source])

Flow ▸ Simulate ▸ Import results…: a solved job folder or a results.json → analysed against the design; the

info_window(title, text[, buttons]) → _Window

Read-only text in a non-modal window, with optional extra buttons {key: (label, function)}.

open_folder(path) → None

open_results_file([wait, source])

Flow ▸ Simulate ▸ Open results file…: pick a results file (e.g. the <name>_<group>_results.json a run saved in

open_sim_layout([wait, names, subset, analysis, group])

Simulate ▸ Open simulation layout…: export the job geometry of the selection, the default subset or a saved sim

propose([wait])

Flow ▸ Results ▸ Propose next revision…: loop.feedback in the background, then a preview of old → new knob

results([wait, quiet])

Flow ▸ Results: the latest values against the targets in a window (and the panel's Results tab). quiet

results_dir() → pathlib.Path

<design folder>/build/<name>: where qcc sim auto saves <name>_<group>_results.json (simsetup.run_dir;

resume_runs([force])

A qcc sim auto run of this design started in an earlier KLayout session: one that ended meanwhile is

save_python([wait, path])

Quantcore ▸ Design ▸ Save as Python script…: qcc design to-python (the drawn chip as a Designer script, to

selected_names() → list[str]

Instances and routes selected with KLayout's own select tool (their id property is the design name).

show_sim_gds(job_dir) → str | None

Open the GDS of the exported job folder in a new layout tab (not the design's view): layers get readable names

sim_layer_name(name) → str

A readable name for a KQC simulation layer (1t1_gap, 1t1_signal_2, 1t1_ground).

sim_layout_args(design, target, subset, names, analysis) → list

qcc sim subset arguments of the simulation layout: the job export with nothing written to the design (and no

sim_layout_missing_lj(subset, names, analysis, group, ...) → str

The Simulate dialog's pre-check, for Open simulation layout: an eigenmode / driven layout puts a lumped L‖C

sim_settings_saved() → dict

simlayout_root() → pathlib.Path

simulate([wait, names, subset, window, analysis, settings])

Flow ▸ Simulate: the Simulate dialog (simulate_dialog(): what is rendered, Q3D or eigenmode, the solver

simulate_dialog(names)

What to simulate and how → {"scope": selection\|default\|whole, "analysis", "settings", "window", "action": run\|export\|layout} or None (cancelled). The analysis (Q3D capacitance or HFSS eigenmode; driven runs are for scripts) is preset from the selection (simsetup.recommend()). The solver settings (passes, convergence, modes, mesh seeds) are filled with the fast values and can be changed; the last values are kept. The last run's convergence (convergence.json) is shown.

Module Contents

class qcc_kplugin.flow.FlowJob(steps, label, done, cwd=None, status_file=None)

Bases: qcc_kplugin.jobs.Job

A jobs.Job that shows its own progress (a status file the qcc command writes plus the AEDT progress line in its output) and can be stopped (only the process tree it started).

cancel() → None

Stop the job: the qcc process and the AEDT it started (taskkill /T), nothing else.

poll() → None
progress_line() → str
status() → dict
cancelled = False
last_step = ''
status_file
class qcc_kplugin.flow.ProposalWindow(proposal: dict, path: pathlib.Path)

Bases: _Window

A non-modal window with a title, text and a Close button (results of background jobs: never modal from a timer).

apply()
table
class qcc_kplugin.flow.ResultsDialog

Bases: _Window

Latest values against the targets (the sidecar’s results: the same rows as the panel’s Results tab), plus the tune buttons. Refreshes itself when the layout is rebuilt.

refresh() → None
header
tree
class qcc_kplugin.flow.SimJob(steps, label, done, cwd=None, status_file=None, record=None)

Bases: FlowJob

qcc sim auto, started detached so it outlives KLayout (see simrun). Its output goes to <design>.flow/sim_run.log and the run record sim_run.json keeps its pid and outcome. With record (a run from an earlier KLayout session) nothing is started: the job watches that run’s pid and ends when it does.

flow_dir
record = None
qcc_kplugin.flow.aedt_path_too_long(job_dir) → bool

AEDT fails on Windows when its *.aedtresults folders pass 260 characters; the job folder name is repeated in them (the same rule as quantcore_circuits.guiflow.aedt_path_too_long).

qcc_kplugin.flow.apply_proposal(proposal: dict, path: pathlib.Path, wait: bool = False)

Write a proposal’s knobs to design.json through the session (one undo step) and rebuild.

qcc_kplugin.flow.ask_dir(title: str, start: str) → str | None
qcc_kplugin.flow.ask_file(title: str, start: str, pattern: str = 'JSON (*.json)') → str | None
qcc_kplugin.flow.choose(title: str, text: str, choices: list[str], checkbox: str | None = None)

A small modal question: one button per choice and Cancel. Returns (index, checked) or None. (An auto-accepted dialog returns the first choice, which is how the GUI smoke test drives it.)

qcc_kplugin.flow.export_job(wait: bool = False, names=None, subset: str | None = None, folder: str | None = None, analysis: str | None = None, settings: dict | None = None)

The Simulate dialog’s Export the job only button: write the job folder (geometry, AEDT scripts, job.json, README.md with what to run and what to bring back, results_template.json) for the selected components, to solve by hand or elsewhere.

qcc_kplugin.flow.fab(wait: bool = False, folder: str | None = None, force: bool = False)

Flow ▸ Fab: the fab mask (qcc mask, PDK fab layers, cheese and corner rounding), the netlist (circuit.json), design.py and a PNG, all into one folder.

qcc_kplugin.flow.import_results(wait: bool = False, source: str | None = None)

Flow ▸ Simulate ▸ Import results…: a solved job folder or a results.json → analysed against the design; the Results tab and dialog show the outcome.

qcc_kplugin.flow.info_window(title: str, text: str, buttons: dict | None = None) → _Window

Read-only text in a non-modal window, with optional extra buttons {key: (label, function)}.

qcc_kplugin.flow.open_folder(path) → None
qcc_kplugin.flow.open_results_file(wait: bool = False, source: str | None = None)

Flow ▸ Simulate ▸ Open results file…: pick a results file (e.g. the <name>_<group>_results.json a run saved in build/<name>, or one solved by hand) and analyse it against the design, without the job-folder question.

qcc_kplugin.flow.open_sim_layout(wait: bool = False, names=None, subset: str | None = None, analysis: str | None = None, group: str | None = None)

Simulate ▸ Open simulation layout…: export the job geometry of the selection, the default subset or a saved sim group (the same path as Export the job only, no AEDT) to a temporary folder and open the GDS that AEDT imports in a new layout tab, with readable layer names: the cut-out metal and gaps, the junction sheets and the port polygons. The design and its build are never touched. An eigenmode / driven layout with a qubit that has no L_J is not exported: a window names the qubit and offers the Q3D layout instead (sim_layout_missing_lj()).

qcc_kplugin.flow.propose(wait: bool = False)

Flow ▸ Results ▸ Propose next revision…: loop.feedback in the background, then a preview of old → new knob values with Apply (writes them to design.json; Quantcore > Edit > Undo takes them back).

qcc_kplugin.flow.results(wait: bool = False, quiet: bool = False)

Flow ▸ Results: the latest values against the targets in a window (and the panel’s Results tab). quiet (called when a background job ends, i.e. from a timer): a failure goes to the status bar and the log, no dialog.

qcc_kplugin.flow.results_dir() → pathlib.Path

<design folder>/build/<name>: where qcc sim auto saves <name>_<group>_results.json (simsetup.run_dir; build/<name> is also where convergence.json and the run state live).

qcc_kplugin.flow.resume_runs(force: bool = False)

A qcc sim auto run of this design started in an earlier KLayout session: one that ended meanwhile is imported (its results are in the run state: the layout is rebuilt and the Results tab filled); one still going is watched and imported when it ends. Returns the watching job, or None. Called when a design is opened.

qcc_kplugin.flow.save_python(wait: bool = False, path: str | None = None)

Quantcore ▸ Design ▸ Save as Python script…: qcc design to-python (the drawn chip as a Designer script, to continue it as code; the fab export puts the same script beside the mask).

qcc_kplugin.flow.selected_names() → list[str]

Instances and routes selected with KLayout’s own select tool (their id property is the design name).

qcc_kplugin.flow.show_sim_gds(job_dir) → str | None

Open the GDS of the exported job folder in a new layout tab (not the design’s view): layers get readable names and colours; the port polygons of <sim>.json are added as two extra layers in memory (the file is not changed). Returns the tab’s title, or None when the folder holds no GDS.

qcc_kplugin.flow.sim_layer_name(name: str) → str

A readable name for a KQC simulation layer (1t1_gap, 1t1_signal_2, 1t1_ground).

qcc_kplugin.flow.sim_layout_args(design, target, subset: str, names, analysis: str, group: str | None = None) → list

qcc sim subset arguments of the simulation layout: the job export with nothing written to the design (and no AEDT): the selection, the default subset or a saved sim group, to target.

qcc_kplugin.flow.sim_layout_missing_lj(subset: str, names, analysis: str, group: str | None, design_data: dict) → str

The Simulate dialog’s pre-check, for Open simulation layout: an eigenmode / driven layout puts a lumped L‖C sheet on each junction, so a qubit without an L_J would fail the export. The warning that names them and says where to set the value, or “” (all set, or a capacitance analysis, which needs none).

qcc_kplugin.flow.sim_settings_saved() → dict
qcc_kplugin.flow.simlayout_root() → pathlib.Path
qcc_kplugin.flow.simulate(wait: bool = False, names=None, subset: str | None = None, window: bool | None = None, analysis: str | None = None, settings: dict | None = None)

Flow ▸ Simulate: the Simulate dialog (simulate_dialog(): what is rendered, Q3D or eigenmode, the solver settings, the last run’s convergence), then qcc sim auto in the background (or the job export). A run in progress is offered to stop instead. subset (“selection” | “default” | “whole”) with names / window / analysis / settings skips the dialog (tests; no settings: the fast ones).

qcc_kplugin.flow.simulate_dialog(names: list[str])

What to simulate and how → {"scope": selection\|default\|whole, "analysis", "settings", "window", "action": run\|export\|layout} or None (cancelled). The analysis (Q3D capacitance or HFSS eigenmode; driven runs are for scripts) is preset from the selection (simsetup.recommend()). The solver settings (passes, convergence, modes, mesh seeds) are filled with the fast values and can be changed; the last values are kept. The last run’s convergence (convergence.json) is shown.

qcc_kplugin.flow.ACTIONS
qcc_kplugin.flow.AEDT_PATH_LIMIT = 250
qcc_kplugin.flow.CFG_AEDT_WINDOW = 'qcc-kplugin-aedt-window'
qcc_kplugin.flow.CFG_SIM = 'qcc-kplugin-sim-settings'
qcc_kplugin.flow.DEFAULT_LAYOUT_CHOICES
qcc_kplugin.flow.DIALOGS: list = []
qcc_kplugin.flow.PORT_LAYERS
qcc_kplugin.flow.SIMLAYOUT_PREFIX = 'qcc_simlayout'