quantcore-circuits 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- quantcore_circuits/__init__.py +57 -0
- quantcore_circuits/analysis/__init__.py +12 -0
- quantcore_circuits/analysis/_metal.py +70 -0
- quantcore_circuits/analysis/amplifiers.py +263 -0
- quantcore_circuits/analysis/circuits.py +117 -0
- quantcore_circuits/analysis/epr.py +231 -0
- quantcore_circuits/analysis/epr_lumped.py +372 -0
- quantcore_circuits/analysis/extract.py +119 -0
- quantcore_circuits/analysis/lom.py +80 -0
- quantcore_circuits/analysis/results.py +549 -0
- quantcore_circuits/analysis/store.py +81 -0
- quantcore_circuits/analysis/synthesis.py +118 -0
- quantcore_circuits/analysis/transmon.py +126 -0
- quantcore_circuits/assembly/__init__.py +17 -0
- quantcore_circuits/assembly/builder.py +127 -0
- quantcore_circuits/assembly/drc.py +683 -0
- quantcore_circuits/assembly/last_good.py +137 -0
- quantcore_circuits/assembly/netlist.py +174 -0
- quantcore_circuits/assembly/plan.py +605 -0
- quantcore_circuits/assembly/sidecar.py +270 -0
- quantcore_circuits/autotrack.py +605 -0
- quantcore_circuits/cards.py +878 -0
- quantcore_circuits/circuit/__init__.py +14 -0
- quantcore_circuits/circuit/adapters.py +305 -0
- quantcore_circuits/circuit/bridges.py +353 -0
- quantcore_circuits/circuit/consensus.py +158 -0
- quantcore_circuits/circuit/derive.py +28 -0
- quantcore_circuits/circuit/draw.py +198 -0
- quantcore_circuits/circuit/fill.py +828 -0
- quantcore_circuits/circuit/hamiltonian.py +193 -0
- quantcore_circuits/circuit/kinetic.py +102 -0
- quantcore_circuits/circuit/schema.py +139 -0
- quantcore_circuits/cli.py +1085 -0
- quantcore_circuits/codesign.py +1038 -0
- quantcore_circuits/data/selftest_q1_r1.json +44 -0
- quantcore_circuits/design/__init__.py +44 -0
- quantcore_circuits/design/io.py +98 -0
- quantcore_circuits/design/pyscript.py +395 -0
- quantcore_circuits/design/schema.py +398 -0
- quantcore_circuits/designer.py +625 -0
- quantcore_circuits/guiflow.py +991 -0
- quantcore_circuits/kqc_files.py +208 -0
- quantcore_circuits/layouts/__init__.py +118 -0
- quantcore_circuits/layouts/catalog.py +520 -0
- quantcore_circuits/layouts/chips/__init__.py +0 -0
- quantcore_circuits/layouts/chips/design_chip.py +325 -0
- quantcore_circuits/layouts/chips/frame.py +235 -0
- quantcore_circuits/layouts/junctions/__init__.py +0 -0
- quantcore_circuits/layouts/junctions/jj_fingers.py +99 -0
- quantcore_circuits/layouts/junctions/legacy_junctions.py +237 -0
- quantcore_circuits/layouts/junctions/sim_gap.py +48 -0
- quantcore_circuits/layouts/junctions/trilayer.py +541 -0
- quantcore_circuits/layouts/metal/__init__.py +105 -0
- quantcore_circuits/layouts/metal/component.py +332 -0
- quantcore_circuits/layouts/metal/geometry.py +462 -0
- quantcore_circuits/layouts/others/__init__.py +0 -0
- quantcore_circuits/layouts/others/amplifiers.py +1139 -0
- quantcore_circuits/layouts/others/bond_pad.py +119 -0
- quantcore_circuits/layouts/others/connector_pads.py +190 -0
- quantcore_circuits/layouts/others/couplers.py +21 -0
- quantcore_circuits/layouts/others/cpw_segment.py +131 -0
- quantcore_circuits/layouts/others/cpwe.py +661 -0
- quantcore_circuits/layouts/others/keepout.py +66 -0
- quantcore_circuits/layouts/others/legacy_resonators.py +645 -0
- quantcore_circuits/layouts/others/markers.py +201 -0
- quantcore_circuits/layouts/others/qpdk_cells.py +263 -0
- quantcore_circuits/layouts/others/shapes.py +114 -0
- quantcore_circuits/layouts/others/spirals.py +140 -0
- quantcore_circuits/layouts/others/sqdmetal_cells.py +90 -0
- quantcore_circuits/layouts/others/test_pads.py +461 -0
- quantcore_circuits/layouts/ports.py +119 -0
- quantcore_circuits/layouts/qubits/__init__.py +0 -0
- quantcore_circuits/layouts/qubits/legacy_transmon.py +124 -0
- quantcore_circuits/layouts/qubits/qpdk_cells.py +374 -0
- quantcore_circuits/layouts/qubits/sqdmetal_cells.py +376 -0
- quantcore_circuits/layouts/qubits/trilayer_concentric.py +65 -0
- quantcore_circuits/layouts/qubits/xmon.py +375 -0
- quantcore_circuits/layouts/registry.py +418 -0
- quantcore_circuits/layouts/wafers/__init__.py +0 -0
- quantcore_circuits/layouts/wafers/fab_export.py +454 -0
- quantcore_circuits/layouts/wafers/legacy_wafer.py +111 -0
- quantcore_circuits/layouts/wafers/wafer.py +469 -0
- quantcore_circuits/live/__init__.py +6 -0
- quantcore_circuits/live/klayout.py +225 -0
- quantcore_circuits/live/klive.py +61 -0
- quantcore_circuits/live/snapshot.py +185 -0
- quantcore_circuits/live/watch.py +93 -0
- quantcore_circuits/lom/__init__.py +15 -0
- quantcore_circuits/lom/builder.py +932 -0
- quantcore_circuits/lom/calibration.py +82 -0
- quantcore_circuits/lom/estimates.py +235 -0
- quantcore_circuits/lom/fragment.py +421 -0
- quantcore_circuits/lom/kqc_models.py +734 -0
- quantcore_circuits/lom/metal_models.py +917 -0
- quantcore_circuits/lom/quantcore_models.py +784 -0
- quantcore_circuits/lom/simulate.py +636 -0
- quantcore_circuits/lom/synthesize.py +189 -0
- quantcore_circuits/loop.py +610 -0
- quantcore_circuits/optimise.py +423 -0
- quantcore_circuits/pdk/__init__.py +451 -0
- quantcore_circuits/plots.py +876 -0
- quantcore_circuits/plugins.py +69 -0
- quantcore_circuits/review/__init__.py +57 -0
- quantcore_circuits/review/server.py +251 -0
- quantcore_circuits/review/static/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- quantcore_circuits/review/static/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- quantcore_circuits/review/static/assets/index-CDHdrFyA.css +1 -0
- quantcore_circuits/review/static/assets/index-CSx05Og4.js +409 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-400-normal-HOLc17fK.woff +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-400-normal-obahsSVq.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-500-normal-BasfLYem.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-500-normal-CxZf_p3X.woff +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-600-normal-4D_pXhcN.woff +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-600-normal-CWCymEST.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-700-normal-CjBOestx.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-700-normal-DrXBdSj3.woff +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-ext-400-normal-BQZuk6qB.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-ext-400-normal-DQukG94-.woff +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-ext-500-normal-B0yAr1jD.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-ext-500-normal-BmqWE9Dz.woff +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-ext-600-normal-Bcila6Z-.woff +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-ext-600-normal-Dfes3d0z.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-ext-700-normal-BjwYoWNd.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-cyrillic-ext-700-normal-LO58E6JB.woff +0 -0
- quantcore_circuits/review/static/assets/inter-greek-400-normal-B4URO6DV.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-greek-400-normal-q2sYcFCs.woff +0 -0
- quantcore_circuits/review/static/assets/inter-greek-500-normal-BIZE56-Y.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-greek-500-normal-Xzm54t5V.woff +0 -0
- quantcore_circuits/review/static/assets/inter-greek-600-normal-BZpKdvQh.woff +0 -0
- quantcore_circuits/review/static/assets/inter-greek-600-normal-plRanbMR.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-greek-700-normal-BUv2fZ6O.woff +0 -0
- quantcore_circuits/review/static/assets/inter-greek-700-normal-C3JjAnD8.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-greek-ext-400-normal-DGGRlc-M.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-greek-ext-400-normal-KugGGMne.woff +0 -0
- quantcore_circuits/review/static/assets/inter-greek-ext-500-normal-2j5mBUwD.woff +0 -0
- quantcore_circuits/review/static/assets/inter-greek-ext-500-normal-C4iEst2y.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-greek-ext-600-normal-B8X0CLgF.woff +0 -0
- quantcore_circuits/review/static/assets/inter-greek-ext-600-normal-DRtmH8MT.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-greek-ext-700-normal-BoQ6DsYi.woff +0 -0
- quantcore_circuits/review/static/assets/inter-greek-ext-700-normal-qfdV9bQt.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-latin-400-normal-C38fXH4l.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-latin-400-normal-CyCys3Eg.woff +0 -0
- quantcore_circuits/review/static/assets/inter-latin-500-normal-BL9OpVg8.woff +0 -0
- quantcore_circuits/review/static/assets/inter-latin-500-normal-Cerq10X2.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-latin-600-normal-CiBQ2DWP.woff +0 -0
- quantcore_circuits/review/static/assets/inter-latin-600-normal-LgqL8muc.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-latin-700-normal-BLAVimhd.woff +0 -0
- quantcore_circuits/review/static/assets/inter-latin-700-normal-Yt3aPRUw.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-latin-ext-400-normal-77YHD8bZ.woff +0 -0
- quantcore_circuits/review/static/assets/inter-latin-ext-400-normal-C1nco2VV.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-latin-ext-500-normal-BxGbmqWO.woff +0 -0
- quantcore_circuits/review/static/assets/inter-latin-ext-500-normal-CV4jyFjo.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-latin-ext-600-normal-CIVaiw4L.woff +0 -0
- quantcore_circuits/review/static/assets/inter-latin-ext-600-normal-D2bJ5OIk.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-latin-ext-700-normal-Ca8adRJv.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-latin-ext-700-normal-TidjK2hL.woff +0 -0
- quantcore_circuits/review/static/assets/inter-vietnamese-400-normal-Bbgyi5SW.woff +0 -0
- quantcore_circuits/review/static/assets/inter-vietnamese-400-normal-DMkecbls.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-vietnamese-500-normal-DOriooB6.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-vietnamese-500-normal-mJboJaSs.woff +0 -0
- quantcore_circuits/review/static/assets/inter-vietnamese-600-normal-BuLX-rYi.woff +0 -0
- quantcore_circuits/review/static/assets/inter-vietnamese-600-normal-Cc8MFFhd.woff2 +0 -0
- quantcore_circuits/review/static/assets/inter-vietnamese-700-normal-BZaoP0fm.woff +0 -0
- quantcore_circuits/review/static/assets/inter-vietnamese-700-normal-DlLaEgI2.woff2 +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
- quantcore_circuits/review/static/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
- quantcore_circuits/review/static/index.html +14 -0
- quantcore_circuits/review/static/logo-quantcore-black.png +0 -0
- quantcore_circuits/review/static/logo-quantcore-white.png +0 -0
- quantcore_circuits/review/static/sample/chip.png +0 -0
- quantcore_circuits/review/static/sample/chip_rev1.png +0 -0
- quantcore_circuits/review/static/sample/q1.png +0 -0
- quantcore_circuits/review/static/sample/q2.png +0 -0
- quantcore_circuits/review/static/sample-state.json +3747 -0
- quantcore_circuits/route/__init__.py +5 -0
- quantcore_circuits/route/router.py +694 -0
- quantcore_circuits/route/waveguide.py +187 -0
- quantcore_circuits/selftest.py +224 -0
- quantcore_circuits/sim_tools/__init__.py +6 -0
- quantcore_circuits/sim_tools/aedt_attach.py +66 -0
- quantcore_circuits/sim_tools/aedt_progress.py +224 -0
- quantcore_circuits/sim_tools/aedt_project.py +302 -0
- quantcore_circuits/sim_tools/aedt_scripts.py +397 -0
- quantcore_circuits/sim_tools/aedt_session.py +275 -0
- quantcore_circuits/sim_tools/ansys.py +90 -0
- quantcore_circuits/sim_tools/builder.py +1690 -0
- quantcore_circuits/sim_tools/export.py +470 -0
- quantcore_circuits/sim_tools/geometry_check.py +342 -0
- quantcore_circuits/sim_tools/hfss.py +583 -0
- quantcore_circuits/sim_tools/palace.py +197 -0
- quantcore_circuits/sim_tools/runner.py +179 -0
- quantcore_circuits/sim_tools/subset.py +364 -0
- quantcore_circuits/track.py +671 -0
- quantcore_circuits-0.0.1.dist-info/METADATA +204 -0
- quantcore_circuits-0.0.1.dist-info/RECORD +272 -0
- quantcore_circuits-0.0.1.dist-info/WHEEL +5 -0
- quantcore_circuits-0.0.1.dist-info/entry_points.txt +2 -0
- quantcore_circuits-0.0.1.dist-info/licenses/LICENSE +674 -0
- quantcore_circuits-0.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1085 @@
|
|
|
1
|
+
"""``qcc`` command line."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
import typer
|
|
10
|
+
|
|
11
|
+
from quantcore_circuits import __version__
|
|
12
|
+
|
|
13
|
+
# Piped or redirected output on Windows defaults to cp1252, and `qcc --help` (Rich box characters, µ, →, Δ) crashed
|
|
14
|
+
# with UnicodeEncodeError. Pipes get UTF-8; a console that still cannot encode a character shows "?" instead.
|
|
15
|
+
for _stream in (sys.stdout, sys.stderr):
|
|
16
|
+
try:
|
|
17
|
+
if (getattr(_stream, "encoding", "") or "").lower().replace("-", "") != "utf8":
|
|
18
|
+
if _stream.isatty():
|
|
19
|
+
_stream.reconfigure(errors="replace")
|
|
20
|
+
else:
|
|
21
|
+
_stream.reconfigure(encoding="utf-8", errors="replace")
|
|
22
|
+
except (AttributeError, ValueError, OSError):
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
app = typer.Typer(
|
|
26
|
+
help="Quantcore circuits: design.json → KQC layout → simulation → parameters → feedback.", no_args_is_help=True
|
|
27
|
+
)
|
|
28
|
+
sim_app = typer.Typer(help="Simulation jobs (HFSS/Q3D, Elmer, Palace).", no_args_is_help=True)
|
|
29
|
+
results_app = typer.Typer(help="Parse, extract and store results.", no_args_is_help=True)
|
|
30
|
+
runner_app = typer.Typer(help="Job runner / filesystem queue (lab server).", no_args_is_help=True)
|
|
31
|
+
design_app = typer.Typer(help="design.json utilities.", no_args_is_help=True)
|
|
32
|
+
hfss_app = typer.Typer(help="Ansys HFSS / Q3D projects (AEDT 2024 R1/R2).", no_args_is_help=True)
|
|
33
|
+
circuit_app = typer.Typer(
|
|
34
|
+
help="Lumped circuit (LOM): layout → circuit.json, LOM simulation, circuit → layout.", no_args_is_help=True
|
|
35
|
+
)
|
|
36
|
+
app.add_typer(sim_app, name="sim")
|
|
37
|
+
app.add_typer(results_app, name="results")
|
|
38
|
+
app.add_typer(runner_app, name="runner")
|
|
39
|
+
app.add_typer(design_app, name="design")
|
|
40
|
+
app.add_typer(hfss_app, name="hfss")
|
|
41
|
+
app.add_typer(circuit_app, name="circuit")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _version(value: bool):
|
|
45
|
+
if value:
|
|
46
|
+
typer.echo(f"quantcore-circuits {__version__}")
|
|
47
|
+
raise typer.Exit()
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@app.callback()
|
|
51
|
+
def main(version: bool = typer.Option(False, "--version", callback=_version, is_eager=True, help="Show version.")):
|
|
52
|
+
"""Quantcore circuits CLI."""
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@app.command()
|
|
56
|
+
def selftest(
|
|
57
|
+
allow_missing: bool = typer.Option(
|
|
58
|
+
False, "--allow-missing", help="A missing extra (analysis, sim, notebook) is skipped instead of failing."
|
|
59
|
+
),
|
|
60
|
+
as_json: bool = typer.Option(False, "--json", help="Print the checks as JSON."),
|
|
61
|
+
):
|
|
62
|
+
"""Check this install: imports of every extra, a Q1 + R1 chip (build, DRC, LOM, job export), ansysedt lookup."""
|
|
63
|
+
from quantcore_circuits.selftest import main as run_selftest # pylint: disable=import-outside-toplevel
|
|
64
|
+
|
|
65
|
+
code = run_selftest(allow_missing=allow_missing, as_json=as_json)
|
|
66
|
+
if code:
|
|
67
|
+
raise typer.Exit(code)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@app.command("kqc-files")
|
|
71
|
+
def kqc_files(
|
|
72
|
+
version: str = typer.Option(None, "--version", help="kqcircuits version (default: the installed one)."),
|
|
73
|
+
source: Path = typer.Option(
|
|
74
|
+
None, "--source", help="A KQCircuits checkout or a source zip, instead of the download."
|
|
75
|
+
),
|
|
76
|
+
force: bool = typer.Option(False, "--force", help="Fetch again even when the cache has them."),
|
|
77
|
+
):
|
|
78
|
+
"""Fetch the KQCircuits files its PyPI package lacks: the simulation scripts and the label font.
|
|
79
|
+
|
|
80
|
+
Downloads them for the installed kqcircuits release from github.com/iqm-finland/KQCircuits into the user cache
|
|
81
|
+
(the HFSS / Q3D / Elmer export and KQC's chip-frame labels need them). Nothing to do for a KQCircuits checkout.
|
|
82
|
+
"""
|
|
83
|
+
from quantcore_circuits import kqc_files as kf # pylint: disable=import-outside-toplevel
|
|
84
|
+
|
|
85
|
+
found, where = kf.find_kqc_scripts()
|
|
86
|
+
font = kf.ensure_kqc_data()
|
|
87
|
+
if found is not None and where == "kqcircuits" and font is not None and not force:
|
|
88
|
+
typer.echo(f"kqcircuits has its own scripts and font: {found}")
|
|
89
|
+
return
|
|
90
|
+
try:
|
|
91
|
+
path = kf.fetch_kqc_files(version=version, source=source, force=force)
|
|
92
|
+
except (OSError, ValueError) as e:
|
|
93
|
+
typer.echo(f"could not fetch the KQCircuits files: {e}", err=True)
|
|
94
|
+
raise typer.Exit(1) from e
|
|
95
|
+
typer.echo(f"KQCircuits files for {version or kf.kqc_version()}: {path}")
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
# ---- layout -------------------------------------------------------------------------------------------------------
|
|
99
|
+
LABEL_HEIGHT_HELP = ("Height of the instance name labels in µm (capital letters; 0 = none). Default: KQC's 280. An "
|
|
100
|
+
"annotation layer only: the fab mask, simulations and the design hash do not change.")
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def _label_override(label_height: float | None) -> dict:
|
|
104
|
+
"""The chip override of ``--label-height`` (none when not given: the default build stays as it is)."""
|
|
105
|
+
if label_height is None:
|
|
106
|
+
return {}
|
|
107
|
+
if label_height < 0:
|
|
108
|
+
raise typer.BadParameter("--label-height must be >= 0")
|
|
109
|
+
return {"instance_label_height": float(label_height)}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@app.command()
|
|
113
|
+
def build(
|
|
114
|
+
design: Path,
|
|
115
|
+
out: Path = typer.Option(None, "-o", help="Output .oas/.gds (default build/<name>.oas)"),
|
|
116
|
+
show: bool = typer.Option(False, help="Send to KLayout via klive"),
|
|
117
|
+
keep_going: bool = typer.Option(
|
|
118
|
+
False,
|
|
119
|
+
"--keep-going",
|
|
120
|
+
help="A route that cannot be built is left out (named in the sidecar's failed_routes, its last good route kept "
|
|
121
|
+
"in <name>.last_good_routes.json) instead of failing the build. The default is strict.",
|
|
122
|
+
),
|
|
123
|
+
label_height: float = typer.Option(
|
|
124
|
+
None, "--label-height", help=LABEL_HEIGHT_HELP,
|
|
125
|
+
),
|
|
126
|
+
):
|
|
127
|
+
"""Build DESIGN (.json/.py) into a KQC chip and write it."""
|
|
128
|
+
from quantcore_circuits.assembly import build as build_design # pylint: disable=import-outside-toplevel
|
|
129
|
+
from quantcore_circuits.assembly import last_good, write_layout # pylint: disable=import-outside-toplevel
|
|
130
|
+
|
|
131
|
+
prev = None
|
|
132
|
+
if keep_going: # the output path is known before the build: the last good routes sit beside it
|
|
133
|
+
from quantcore_circuits.design import load_design # pylint: disable=import-outside-toplevel
|
|
134
|
+
|
|
135
|
+
prev = last_good.load(last_good.store_path(out or Path("build") / f"{load_design(design).name}.oas"))
|
|
136
|
+
result = build_design(design, keep_going=keep_going, last_good=prev, **_label_override(label_height))
|
|
137
|
+
out = out or Path("build") / f"{result.design.name}.oas"
|
|
138
|
+
write_layout(result, out)
|
|
139
|
+
typer.echo(f"wrote {out} (hash {result.hash})")
|
|
140
|
+
for name, length in result.route_lengths().items():
|
|
141
|
+
typer.echo(f" route {name}: {length:.2f} um")
|
|
142
|
+
for name, failed in result.failed_routes.items(): # only with --keep-going
|
|
143
|
+
typer.echo(f" FAILED {failed.error} (route {name} is not in the layout"
|
|
144
|
+
+ ("; its last good route is kept)" if failed.last_good else ")"), err=True)
|
|
145
|
+
if show:
|
|
146
|
+
from quantcore_circuits.live import send_to_klive # pylint: disable=import-outside-toplevel
|
|
147
|
+
|
|
148
|
+
typer.echo(f"klive: {send_to_klive(out)}")
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
@app.command()
|
|
152
|
+
def watch(
|
|
153
|
+
design: Path,
|
|
154
|
+
out: Path = typer.Option(None, "-o"),
|
|
155
|
+
klive: bool = typer.Option(True, help="Use klive"),
|
|
156
|
+
extra: list[Path] = typer.Option(None, help="More files to watch (e.g. imported modules)"),
|
|
157
|
+
label_height: float = typer.Option(None, "--label-height", help=LABEL_HEIGHT_HELP),
|
|
158
|
+
):
|
|
159
|
+
"""Rebuild on every save and reload KLayout (klive)."""
|
|
160
|
+
from quantcore_circuits.live import watch as run_watch # pylint: disable=import-outside-toplevel
|
|
161
|
+
|
|
162
|
+
run_watch(design, out, extra=extra, klive=klive, chip_overrides=_label_override(label_height))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
@app.command()
|
|
166
|
+
def components(
|
|
167
|
+
cell: str = typer.Argument(None, help="Show ports of this cell (name, dotted path or metal:<Class>)"),
|
|
168
|
+
category: str = typer.Option(None, "--category", "-c", help="Only this category (qubit, coupler, launcher, ...)"),
|
|
169
|
+
source: str = typer.Option(None, "--source", "-s", help="Only this source: quantcore, kqc or metal"),
|
|
170
|
+
as_json: bool = typer.Option(False, "--json", help="Machine-readable: refs (or ports with CELL)"),
|
|
171
|
+
details: bool = typer.Option(False, "--details", help="With --json: full catalog records instead of refs"),
|
|
172
|
+
show_all: bool = typer.Option(False, "--all", help="Include whole KQC chips and Metal routes (not cells)"),
|
|
173
|
+
outline: bool = typer.Option(
|
|
174
|
+
False, "--outline", help="With CELL --json: also its bbox and a simplified outline (the KLayout placement ghost)"
|
|
175
|
+
),
|
|
176
|
+
params: str = typer.Option("{}", "--params", help="With CELL: PCell parameters as JSON"),
|
|
177
|
+
schema: bool = typer.Option(False, "--schema", help="With CELL: its editable parameters and defaults (JSON)"),
|
|
178
|
+
schemas: bool = typer.Option(
|
|
179
|
+
False, "--schemas", help="Every listed cell's editable parameters in one JSON (the KLayout PCell library)"
|
|
180
|
+
),
|
|
181
|
+
oas: Path = typer.Option(None, "--oas", help="With CELL: write its geometry (a static cell) to this OASIS file"),
|
|
182
|
+
design: Path = typer.Option(
|
|
183
|
+
None, "--design", help="With CELL --oas: build it as in this design (chip-inherited parameters, PDK junction)"
|
|
184
|
+
),
|
|
185
|
+
):
|
|
186
|
+
"""List available components (Quantcore, KQC, Quantum Metal) by category, or the ports of one."""
|
|
187
|
+
from quantcore_circuits.assembly.plan import pcell_params # noqa: PLC0415
|
|
188
|
+
from quantcore_circuits.layouts.catalog import catalog # noqa: PLC0415
|
|
189
|
+
from quantcore_circuits.layouts.registry import element_ports, resolve_cell # noqa: PLC0415
|
|
190
|
+
|
|
191
|
+
if cell:
|
|
192
|
+
cls = resolve_cell(cell)
|
|
193
|
+
try:
|
|
194
|
+
user = json.loads(params or "{}")
|
|
195
|
+
except ValueError as e:
|
|
196
|
+
raise typer.BadParameter(f"--params is not JSON: {e}") from e
|
|
197
|
+
if oas:
|
|
198
|
+
_component_oas(cls, user, oas, design)
|
|
199
|
+
typer.echo(str(oas))
|
|
200
|
+
return
|
|
201
|
+
if schema:
|
|
202
|
+
from quantcore_circuits.layouts.registry import element_schema # noqa: PLC0415
|
|
203
|
+
|
|
204
|
+
typer.echo(json.dumps(element_schema(cls)))
|
|
205
|
+
return
|
|
206
|
+
if outline:
|
|
207
|
+
from quantcore_circuits.layouts.registry import element_outline # noqa: PLC0415
|
|
208
|
+
|
|
209
|
+
typer.echo(json.dumps(element_outline(cls, **pcell_params(cls, user))))
|
|
210
|
+
return
|
|
211
|
+
ports = element_ports(cls, **pcell_params(cls, user))
|
|
212
|
+
if as_json:
|
|
213
|
+
typer.echo(json.dumps([p.as_dict() for p in ports.values()], indent=2))
|
|
214
|
+
return
|
|
215
|
+
for name, p in ports.items():
|
|
216
|
+
d = p.as_dict()
|
|
217
|
+
typer.echo(f" {name:12s} at {d['at']} dir {d['dir']} a={d['a']} b={d['b']}")
|
|
218
|
+
return
|
|
219
|
+
try:
|
|
220
|
+
entries = catalog(category=category, source=source, chips=show_all or category == "chip", routes=show_all)
|
|
221
|
+
except ValueError as e:
|
|
222
|
+
raise typer.BadParameter(str(e)) from e
|
|
223
|
+
if schemas:
|
|
224
|
+
typer.echo(json.dumps(_cell_schemas([c for c in entries if c.cell])))
|
|
225
|
+
return
|
|
226
|
+
if as_json:
|
|
227
|
+
typer.echo(json.dumps([c.as_dict() for c in entries] if details else [c.ref for c in entries], indent=2))
|
|
228
|
+
return
|
|
229
|
+
current = None
|
|
230
|
+
for c in sorted(entries, key=lambda c: (c.category, c.source != "quantcore", c.ref.lower())):
|
|
231
|
+
if c.category != current:
|
|
232
|
+
current = c.category
|
|
233
|
+
typer.echo(f"{current}:")
|
|
234
|
+
typer.echo(c.listing_line()) # "(legacy)" / "(alias of X)" before the description
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def _cell_schemas(entries) -> dict:
|
|
238
|
+
"""``{ref: {"category", "description", "schema"}}`` for catalog ``entries``: the ``--schema`` rows of each cell,
|
|
239
|
+
each with ``kqc_type`` (``double``, ``int``, ``string``, ``boolean``, ``list``), so the KLayout plugin can declare
|
|
240
|
+
its PCells in one call. A cell that cannot be resolved is left out."""
|
|
241
|
+
from kqcircuits.util.parameters import pdt # noqa: PLC0415
|
|
242
|
+
|
|
243
|
+
from quantcore_circuits.layouts.registry import element_schema, resolve_cell # noqa: PLC0415
|
|
244
|
+
|
|
245
|
+
names = {pdt.TypeDouble: "double", pdt.TypeInt: "int", pdt.TypeString: "string", pdt.TypeBoolean: "boolean",
|
|
246
|
+
pdt.TypeList: "list"}
|
|
247
|
+
out = {}
|
|
248
|
+
for c in entries:
|
|
249
|
+
try:
|
|
250
|
+
cls = resolve_cell(c.ref)
|
|
251
|
+
except ValueError:
|
|
252
|
+
continue
|
|
253
|
+
kqc = cls.get_schema()
|
|
254
|
+
rows = element_schema(cls)
|
|
255
|
+
for row in rows:
|
|
256
|
+
row["kqc_type"] = names.get(kqc[row["name"]].data_type, "string")
|
|
257
|
+
out[c.ref] = {"category": c.category, "description": c.description, "schema": rows}
|
|
258
|
+
return out
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def _component_oas(cls, own: dict, out: Path, design: Path | None = None) -> None:
|
|
262
|
+
"""Write one component's geometry, as a design build makes it (chip-inherited parameters of ``design`` and the
|
|
263
|
+
PDK junction default), to ``out``: a top cell ``qcc_component`` holding the static component cell at the origin."""
|
|
264
|
+
import os # pylint: disable=import-outside-toplevel
|
|
265
|
+
import tempfile # pylint: disable=import-outside-toplevel
|
|
266
|
+
|
|
267
|
+
from kqcircuits.pya_resolver import pya # noqa: PLC0415
|
|
268
|
+
from kqcircuits.util.load_save_layout import save_layout # noqa: PLC0415
|
|
269
|
+
|
|
270
|
+
from quantcore_circuits.assembly.plan import chip_parameters, element_params, inherited_params # noqa: PLC0415
|
|
271
|
+
from quantcore_circuits.layouts.chips.design_chip import ensure_registered # noqa: PLC0415
|
|
272
|
+
from quantcore_circuits.layouts.registry import create_cell # noqa: PLC0415
|
|
273
|
+
|
|
274
|
+
ensure_registered()
|
|
275
|
+
inherited = {}
|
|
276
|
+
if design is not None:
|
|
277
|
+
from quantcore_circuits.design import load_design # noqa: PLC0415
|
|
278
|
+
|
|
279
|
+
inherited = inherited_params(chip_parameters(load_design(design)))
|
|
280
|
+
layout = pya.Layout()
|
|
281
|
+
cell = create_cell(layout, cls, what=cls.__name__, **element_params(cls, inherited, own))
|
|
282
|
+
top = layout.create_cell("qcc_component") # a top-level library proxy is not written; wrap it like a build
|
|
283
|
+
top.insert(pya.DCellInstArray(cell.cell_index(), pya.DTrans()))
|
|
284
|
+
out = Path(out)
|
|
285
|
+
out.parent.mkdir(parents=True, exist_ok=True)
|
|
286
|
+
fd, tmp = tempfile.mkstemp(suffix=out.suffix or ".oas", dir=out.parent)
|
|
287
|
+
os.close(fd)
|
|
288
|
+
try:
|
|
289
|
+
save_layout(tmp, layout, [top])
|
|
290
|
+
os.replace(tmp, out) # atomic: the plugin polls for the file
|
|
291
|
+
finally:
|
|
292
|
+
if os.path.exists(tmp):
|
|
293
|
+
os.remove(tmp)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
@app.command()
|
|
297
|
+
def synth(
|
|
298
|
+
f_q: float = typer.Option(..., help="Qubit f01 [GHz]"),
|
|
299
|
+
alpha: float = typer.Option(..., help="α [MHz]"),
|
|
300
|
+
f_r: float = typer.Option(..., help="Resonator [GHz]"),
|
|
301
|
+
g: float = typer.Option(..., help="g [MHz]"),
|
|
302
|
+
a: float = 10.0,
|
|
303
|
+
b: float = 6.0,
|
|
304
|
+
):
|
|
305
|
+
"""LOM-first synthesis: targets → Lj, C_Σ, Cg, λ/4 length."""
|
|
306
|
+
from quantcore_circuits.analysis.synthesis import synthesize_transmon_readout # noqa: PLC0415
|
|
307
|
+
|
|
308
|
+
res = synthesize_transmon_readout(f_q, alpha, f_r, g, a, b)
|
|
309
|
+
typer.echo(json.dumps(res, indent=2, default=float))
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
@app.command()
|
|
313
|
+
def mask(
|
|
314
|
+
design: Path,
|
|
315
|
+
out: Path = typer.Option(None, "-o"),
|
|
316
|
+
positive: list[str] = typer.Option(None),
|
|
317
|
+
cheese: bool = typer.Option(
|
|
318
|
+
True, help="Cheese: the build's (PDK band or the original design's own); --no-cheese writes none"
|
|
319
|
+
),
|
|
320
|
+
round_corners: bool = typer.Option(True, "--round/--no-round", help="PDK corner rounding (r ∝ shortest dim.)"),
|
|
321
|
+
grid: bool = typer.Option(False, help="KQC's whole-area ground grid (with_grid) instead of the PDK band"),
|
|
322
|
+
):
|
|
323
|
+
"""Fab export with the PDK fab rules: layers 1/0–4/0, 50–53/0, 100/0, 300/301, 700, 800+, 1000/0+; --positive M1
|
|
324
|
+
inverts a layer. Corner rounding is on by default; the cheese is the build's own (the PDK band unless the design
|
|
325
|
+
has its own cheese, which wins). Simulation exports never get either."""
|
|
326
|
+
import warnings # pylint: disable=import-outside-toplevel
|
|
327
|
+
|
|
328
|
+
from quantcore_circuits.assembly import build as build_design # pylint: disable=import-outside-toplevel
|
|
329
|
+
from quantcore_circuits.layouts.wafers.fab_export import export_fab # noqa: PLC0415
|
|
330
|
+
|
|
331
|
+
result = build_design(design, **({"with_grid": True} if grid else {}))
|
|
332
|
+
out = out or Path("build") / f"{result.design.name}_fab.oas"
|
|
333
|
+
report: dict = {}
|
|
334
|
+
with warnings.catch_warnings(): # reported below instead
|
|
335
|
+
warnings.simplefilter("ignore")
|
|
336
|
+
export_fab(
|
|
337
|
+
result,
|
|
338
|
+
out,
|
|
339
|
+
{name: "positive" for name in positive or []},
|
|
340
|
+
report=report,
|
|
341
|
+
cheese=cheese,
|
|
342
|
+
rounding=round_corners,
|
|
343
|
+
)
|
|
344
|
+
typer.echo(
|
|
345
|
+
f"wrote {out} (cheese holes: {report.get('cheese_holes', 0)} from {report.get('cheese_source', 'none')}, "
|
|
346
|
+
f"rounded corners: {round_corners})"
|
|
347
|
+
)
|
|
348
|
+
for name, n in sorted((report.get("written") or {}).items()):
|
|
349
|
+
typer.echo(f" {name}: {n} shapes")
|
|
350
|
+
dropped = report.get("dropped") or {}
|
|
351
|
+
if dropped:
|
|
352
|
+
typer.echo("NOT in the mask (no PDK v2 fab layer for these):", err=True)
|
|
353
|
+
for name, n in sorted(dropped.items()):
|
|
354
|
+
typer.echo(f" {name}: {n} shapes", err=True)
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
@app.command()
|
|
358
|
+
def review(
|
|
359
|
+
design: Path,
|
|
360
|
+
port: int = 8765,
|
|
361
|
+
open_browser: bool = True,
|
|
362
|
+
run_dir: Path = typer.Option(None, help="Run directory (default build/<design name>)"),
|
|
363
|
+
):
|
|
364
|
+
"""Open the live dashboard for DESIGN: steps, goal, plots, circuit, Hamiltonian, jobs, screenshots."""
|
|
365
|
+
from quantcore_circuits.review.server import serve # pylint: disable=import-outside-toplevel
|
|
366
|
+
|
|
367
|
+
serve(design, port=port, open_browser=open_browser, run_dir=run_dir)
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
@app.command()
|
|
371
|
+
def dashboard(
|
|
372
|
+
run: str = typer.Argument(None, help="Run name (build/<run>); default: follow the run with the latest activity"),
|
|
373
|
+
port: int = 8765,
|
|
374
|
+
open_browser: bool = True,
|
|
375
|
+
root: Path = typer.Option(None, help="Folder with the run directories (default: <repo>/build)"),
|
|
376
|
+
):
|
|
377
|
+
"""Live dashboard that follows the notebooks' tracked runs (``track.start(...)`` / ``QCC_TRACK=1``)."""
|
|
378
|
+
from quantcore_circuits.review.server import serve_live # pylint: disable=import-outside-toplevel
|
|
379
|
+
|
|
380
|
+
serve_live(root, run, port=port, open_browser=open_browser)
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
# ---- design -------------------------------------------------------------------------------------------------------
|
|
384
|
+
@design_app.command("validate")
|
|
385
|
+
def design_validate(design: Path):
|
|
386
|
+
from quantcore_circuits.assembly import plan_design # pylint: disable=import-outside-toplevel
|
|
387
|
+
from quantcore_circuits.design import load_design # pylint: disable=import-outside-toplevel
|
|
388
|
+
|
|
389
|
+
d = load_design(design)
|
|
390
|
+
plan = plan_design(d)
|
|
391
|
+
typer.echo(f"ok: {len(d.instances)} instances, {len(d.routes)} routes, {len(plan.all_ports())} ports")
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
@design_app.command("ports")
|
|
395
|
+
def design_ports(design: Path, as_json: bool = typer.Option(False, "--json")):
|
|
396
|
+
"""All resolved ports of a design (absolute positions), e.g. for the KLayout plugin's connect dialog."""
|
|
397
|
+
from quantcore_circuits.assembly import plan_design # pylint: disable=import-outside-toplevel
|
|
398
|
+
from quantcore_circuits.design import load_design # pylint: disable=import-outside-toplevel
|
|
399
|
+
|
|
400
|
+
ports = {ref: p.as_dict() for ref, p in plan_design(load_design(design)).all_ports().items()}
|
|
401
|
+
if as_json:
|
|
402
|
+
typer.echo(json.dumps(ports))
|
|
403
|
+
return
|
|
404
|
+
for ref, p in ports.items():
|
|
405
|
+
typer.echo(f" {ref:18s} at {p['at']} dir {p['dir']} a={p['a']} b={p['b']}")
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
@design_app.command("junctions")
|
|
409
|
+
def design_junctions(
|
|
410
|
+
design: Path,
|
|
411
|
+
names: list[str] = typer.Argument(None, help="Only these instances (default: every component with a junction)"),
|
|
412
|
+
as_json: bool = typer.Option(False, "--json"),
|
|
413
|
+
default: bool = typer.Option(False, "--default", help="No names: the qubits of the default simulation subset"),
|
|
414
|
+
):
|
|
415
|
+
"""Each junction as the LOM and the eigenmode / driven exports take it: L_J0, C_J, flux Φ/Φ0, asymmetry d, L at
|
|
416
|
+
that flux and the source (design or drawn trilayer junction, PDK rule). Exit 1 when one has no L_J."""
|
|
417
|
+
from quantcore_circuits.guiflow import junctions, missing_junctions # pylint: disable=import-outside-toplevel
|
|
418
|
+
|
|
419
|
+
if default and not names:
|
|
420
|
+
from quantcore_circuits.guiflow import resolve_selection # pylint: disable=import-outside-toplevel
|
|
421
|
+
|
|
422
|
+
names = resolve_selection(design, [], default=True)[0]
|
|
423
|
+
if not names:
|
|
424
|
+
names = ["-"] # no qubit at all: nothing to check (an empty list would mean every component)
|
|
425
|
+
found = junctions(design, names or None)
|
|
426
|
+
missing = missing_junctions(design, names or None)
|
|
427
|
+
if as_json:
|
|
428
|
+
typer.echo(json.dumps({"junctions": found, "missing": missing}))
|
|
429
|
+
else:
|
|
430
|
+
for n, j in found.items():
|
|
431
|
+
lj = "none" if j["Lj_eff_nH"] is None else f"{j['Lj_eff_nH']:.4g} nH"
|
|
432
|
+
l0 = "" if j["Lj0_nH"] is None or j["Lj0_nH"] == j["Lj_eff_nH"] else f" (L_J0 {j['Lj0_nH']:.4g} nH)"
|
|
433
|
+
typer.echo(f" {n:14s} {j['kind']:5s} L {lj}{l0}, C {j['Cj_fF']:g} fF, flux {j['flux_phi0']:g}, "
|
|
434
|
+
f"asym {j['asym']:g} [{j['source'] or 'no value'}]")
|
|
435
|
+
for msg in missing.values():
|
|
436
|
+
typer.echo(f" missing: {msg}", err=True)
|
|
437
|
+
if missing:
|
|
438
|
+
raise typer.Exit(1)
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
@design_app.command("placement-junction")
|
|
442
|
+
def design_placement_junction(
|
|
443
|
+
cell: str,
|
|
444
|
+
params: str = typer.Option("{}", "--params", help="Cell parameters as JSON"),
|
|
445
|
+
):
|
|
446
|
+
"""JSON of the junction values a new CELL gets when placed (``{"Lj_nH", "Cj_fF", "source"}``: the drawn trilayer
|
|
447
|
+
junction's PDK value, else the PDK nominal SQUID), or ``null`` for a component without a junction."""
|
|
448
|
+
from quantcore_circuits.guiflow import placement_junction # pylint: disable=import-outside-toplevel
|
|
449
|
+
|
|
450
|
+
typer.echo(json.dumps(placement_junction(cell, json.loads(params))))
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
@design_app.command("netlist")
|
|
454
|
+
def design_netlist(design: Path):
|
|
455
|
+
"""M3 netlist check: declared connections vs. the KQC geometric netlist (opens/shorts with coordinates)."""
|
|
456
|
+
from quantcore_circuits.assembly import build as build_design # pylint: disable=import-outside-toplevel
|
|
457
|
+
from quantcore_circuits.assembly.netlist import check_netlist # pylint: disable=import-outside-toplevel
|
|
458
|
+
|
|
459
|
+
report = check_netlist(build_design(design))
|
|
460
|
+
for group in sorted(report.extracted, key=sorted):
|
|
461
|
+
typer.echo(f" net: {' <-> '.join(sorted(group)) if len(group) > 1 else sorted(group)[0] + ' (open end)'}")
|
|
462
|
+
for issue in report.issues:
|
|
463
|
+
typer.echo(f" {issue}")
|
|
464
|
+
typer.echo("netlist OK" if report.ok else f"netlist: {len(report.opens)} open(s), {len(report.shorts)} short(s)")
|
|
465
|
+
if not report.ok:
|
|
466
|
+
raise typer.Exit(1)
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
@design_app.command("drc")
|
|
470
|
+
def design_drc(
|
|
471
|
+
design: Path,
|
|
472
|
+
netlist: bool = typer.Option(True, help="Also run the KQC netlist check"),
|
|
473
|
+
keep_going: bool = typer.Option(False, "--keep-going", help="Report a route that cannot be built (route_failed) and "
|
|
474
|
+
"check the rest, instead of stopping at it"),
|
|
475
|
+
):
|
|
476
|
+
"""Connectivity DRC: dangling ports, components without LOM, outside chip, overlaps, crossings, opens/shorts."""
|
|
477
|
+
from quantcore_circuits.assembly.drc import check # pylint: disable=import-outside-toplevel
|
|
478
|
+
|
|
479
|
+
report = check(design, netlist=netlist, keep_going=keep_going)
|
|
480
|
+
typer.echo(str(report))
|
|
481
|
+
if not report.ok:
|
|
482
|
+
raise typer.Exit(1)
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
@circuit_app.command("export")
|
|
486
|
+
def circuit_export(
|
|
487
|
+
design: Path,
|
|
488
|
+
group: str = typer.Option("chip", "--group", "-g", help="'chip' (all) or a sim_groups name"),
|
|
489
|
+
out: Path = typer.Option(None, "-o", help="Output circuit.json (default build/<name>.circuit.json)"),
|
|
490
|
+
):
|
|
491
|
+
"""Layout → LOM netlist: components' lumped models joined along routes/snaps (values = component estimates)."""
|
|
492
|
+
from quantcore_circuits.circuit.derive import circuit_from_design # pylint: disable=import-outside-toplevel
|
|
493
|
+
from quantcore_circuits.circuit.schema import save_circuit # pylint: disable=import-outside-toplevel
|
|
494
|
+
from quantcore_circuits.design import load_design # pylint: disable=import-outside-toplevel
|
|
495
|
+
from quantcore_circuits.lom import lom_from_design # pylint: disable=import-outside-toplevel
|
|
496
|
+
|
|
497
|
+
d = load_design(design)
|
|
498
|
+
model = circuit_from_design(design, group)
|
|
499
|
+
out = out or Path("build") / f"{d.name}.circuit.json"
|
|
500
|
+
save_circuit(model, out)
|
|
501
|
+
build = lom_from_design(design) # the file: its last good routes stand in for a failed route
|
|
502
|
+
for n, spec in model.nodes.items():
|
|
503
|
+
typer.echo(f" node {n:14s} {'ground' if spec.ground else ', '.join(spec.nets) or '-'}")
|
|
504
|
+
for n, b in model.branches.items():
|
|
505
|
+
typer.echo(f" {b.type:7s} {n:16s} {b.nodes[0]} - {b.nodes[1]}")
|
|
506
|
+
for name, c in model.controls.items():
|
|
507
|
+
typer.echo(f" control {name}: {c['kind']} -> {c['target']}")
|
|
508
|
+
for note in build.notes:
|
|
509
|
+
typer.echo(f" note: {note}")
|
|
510
|
+
for port in build.unconnected:
|
|
511
|
+
typer.echo(f" unconnected port: {port}")
|
|
512
|
+
typer.echo(f"wrote {out}")
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
@circuit_app.command("simulate")
|
|
516
|
+
def circuit_simulate(
|
|
517
|
+
source: Path = typer.Argument(..., help="circuit.json, or a design (its layout LOM is used)"),
|
|
518
|
+
job: Path = typer.Option(None, help="Fill capacitances from this simulation job (design input only)"),
|
|
519
|
+
group: str = typer.Option("chip", "--group", "-g"),
|
|
520
|
+
json_out: Path = typer.Option(None, "--json", help="Also write the result (modes, params, netlist values) as JSON"),
|
|
521
|
+
png: Path = typer.Option(None, "--png", help="Also draw the circuit schematic (matplotlib) to this PNG"),
|
|
522
|
+
):
|
|
523
|
+
"""LOM simulation: QuCat normal modes + kappa, QuTiP dressed spectrum -> f_q, alpha, f_r, chi, kappa."""
|
|
524
|
+
from quantcore_circuits.circuit.fill import fill # pylint: disable=import-outside-toplevel
|
|
525
|
+
from quantcore_circuits.circuit.schema import load_circuit # pylint: disable=import-outside-toplevel
|
|
526
|
+
from quantcore_circuits.lom.simulate import simulate # pylint: disable=import-outside-toplevel
|
|
527
|
+
|
|
528
|
+
# "[lom] ..." stage lines on stderr (stdout unchanged): the KLayout plugin's Run LOM progress bar reads them
|
|
529
|
+
typer.echo(f"[lom] reading the circuit {source.name}", err=True)
|
|
530
|
+
data = json.loads(source.read_text(encoding="utf-8"))
|
|
531
|
+
if str(data.get("schema", "")).startswith("qcc-circuit"):
|
|
532
|
+
filled = fill(load_circuit(data), None)
|
|
533
|
+
else:
|
|
534
|
+
from quantcore_circuits.circuit.derive import circuit_from_design # pylint: disable=C0415
|
|
535
|
+
|
|
536
|
+
filled = fill(circuit_from_design(source, group), source, job)
|
|
537
|
+
typer.echo(f"[lom] solving {len(filled.model.branches)} branches: QuCat normal modes, then the QuTiP spectrum "
|
|
538
|
+
"(minutes for 5+ qubits)", err=True)
|
|
539
|
+
res = simulate(filled)
|
|
540
|
+
typer.echo(f"[lom] writing the result ({len(res.modes)} modes)", err=True)
|
|
541
|
+
if json_out is not None:
|
|
542
|
+
import dataclasses # pylint: disable=import-outside-toplevel
|
|
543
|
+
|
|
544
|
+
payload = {
|
|
545
|
+
"schema": "qcc-lom-result/0.1",
|
|
546
|
+
"name": filled.model.name,
|
|
547
|
+
"source": str(source),
|
|
548
|
+
"modes": [dataclasses.asdict(m) for m in res.modes],
|
|
549
|
+
"chi_MHz": res.chi_MHz,
|
|
550
|
+
"params": res.params,
|
|
551
|
+
"zz_MHz": res.zz_MHz,
|
|
552
|
+
"notes": list(res.notes),
|
|
553
|
+
"netlist": res.netlist,
|
|
554
|
+
"branches": {n: {"type": b.type, "nodes": list(b.nodes)} for n, b in filled.model.branches.items()},
|
|
555
|
+
"png": str(png) if png is not None else None,
|
|
556
|
+
}
|
|
557
|
+
json_out.parent.mkdir(parents=True, exist_ok=True)
|
|
558
|
+
json_out.write_text(json.dumps(payload, indent=1, default=str), encoding="utf-8")
|
|
559
|
+
if png is not None:
|
|
560
|
+
typer.echo("[lom] drawing the circuit", err=True)
|
|
561
|
+
from quantcore_circuits.circuit.draw import draw_circuit # pylint: disable=import-outside-toplevel
|
|
562
|
+
|
|
563
|
+
draw_circuit(filled.model, res.netlist, png, title=filled.model.name)
|
|
564
|
+
for m in res.modes:
|
|
565
|
+
typer.echo(
|
|
566
|
+
f" mode {m.index} {m.label:6s} {m.kind:9s} f={m.f_GHz:.4f} GHz kappa={m.kappa_MHz:.4g} MHz "
|
|
567
|
+
f"A={m.anharmonicity_MHz:.1f} MHz"
|
|
568
|
+
)
|
|
569
|
+
for k, v in res.params.items():
|
|
570
|
+
typer.echo(f" {k:16s} {v:.5g}")
|
|
571
|
+
for note in res.notes:
|
|
572
|
+
typer.echo(f" note: {note}")
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
@circuit_app.command("layout")
|
|
576
|
+
def circuit_layout(
|
|
577
|
+
circuit: Path,
|
|
578
|
+
out: Path = typer.Option(..., "-o", help="Output design.json"),
|
|
579
|
+
live: bool = typer.Option(False, help="Lay it out live in KLayout"),
|
|
580
|
+
):
|
|
581
|
+
"""LOM -> layout: transmon + lambda/4 pairs with targets -> knobs -> a laid-out feedline chip."""
|
|
582
|
+
from quantcore_circuits.circuit.schema import load_circuit # pylint: disable=import-outside-toplevel
|
|
583
|
+
from quantcore_circuits.lom.synthesize import layout_from_circuit # pylint: disable=import-outside-toplevel
|
|
584
|
+
|
|
585
|
+
d = layout_from_circuit(load_circuit(circuit), live=live)
|
|
586
|
+
for sol in d.synthesis:
|
|
587
|
+
typer.echo(" " + ", ".join(f"{k}={v:.4g}" for k, v in sol["knobs"].items()))
|
|
588
|
+
typer.echo(f"wrote {d.save(out)}")
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
@design_app.command("to-python")
|
|
592
|
+
def design_to_python_cmd(
|
|
593
|
+
design: Path,
|
|
594
|
+
out: Path = typer.Option(None, "-o", help="Output script (default: <design name>.py next to the design)"),
|
|
595
|
+
check: bool = typer.Option(True, help="Run the script here and require the same design hash (default on)"),
|
|
596
|
+
):
|
|
597
|
+
"""Write a readable Python script (the Designer API) that rebuilds DESIGN: the GUI prototype continues as code.
|
|
598
|
+
|
|
599
|
+
The script writes the design.json again (``python design.py``); the round trip is checked (same ``qcc design
|
|
600
|
+
hash``). Entries the Designer calls cannot say are written as plain data with a comment."""
|
|
601
|
+
from quantcore_circuits.design import load_design # pylint: disable=import-outside-toplevel
|
|
602
|
+
from quantcore_circuits.design.pyscript import RoundTripError, write_python # pylint: disable=C0415
|
|
603
|
+
|
|
604
|
+
out = out or Path(design).with_name(f"{load_design(design).name}.py")
|
|
605
|
+
try:
|
|
606
|
+
write_python(design, out, check=check)
|
|
607
|
+
except RoundTripError as e:
|
|
608
|
+
typer.echo(f"error: {e}", err=True)
|
|
609
|
+
raise typer.Exit(1) from e
|
|
610
|
+
typer.echo(f"wrote {out}" + (" (round trip checked: same design hash)" if check else ""))
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
@design_app.command("hash")
|
|
614
|
+
def design_hash_cmd(design: Path):
|
|
615
|
+
from quantcore_circuits.design import design_hash, load_design # pylint: disable=import-outside-toplevel
|
|
616
|
+
|
|
617
|
+
typer.echo(design_hash(load_design(design)))
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
# ---- simulation ---------------------------------------------------------------------------------------------------
|
|
621
|
+
@sim_app.command("build")
|
|
622
|
+
def sim_build(
|
|
623
|
+
design: Path,
|
|
624
|
+
group: str = typer.Option(..., "--group", "-g"),
|
|
625
|
+
analysis: str = typer.Option(
|
|
626
|
+
...,
|
|
627
|
+
"--analysis",
|
|
628
|
+
"-a",
|
|
629
|
+
help="q3d_cmatrix | hfss_eigenmode | eigenmode_epr | elmer_cap | palace_cap | palace_eig",
|
|
630
|
+
),
|
|
631
|
+
out: Path = typer.Option(None, "-o", help="Job directory"),
|
|
632
|
+
overwrite: bool = False,
|
|
633
|
+
):
|
|
634
|
+
"""Create a simulation job directory for a sim group."""
|
|
635
|
+
from quantcore_circuits.sim_tools import build_simulation, export_job # pylint: disable=import-outside-toplevel
|
|
636
|
+
|
|
637
|
+
setup = build_simulation(design, group, analysis)
|
|
638
|
+
out = out or Path("build") / "jobs" / f"{setup.design.name}_{group}_{analysis}"
|
|
639
|
+
export_job(setup, out, overwrite=overwrite)
|
|
640
|
+
typer.echo(f"job {out}")
|
|
641
|
+
for p in setup.ports:
|
|
642
|
+
typer.echo(f" port {p.number}: {p.kind:9s} {p.name}")
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
def _settings(pairs: list[str] | None) -> dict:
|
|
646
|
+
"""``key=value`` pairs → dict; values are JSON when they parse (numbers, booleans, objects), else strings."""
|
|
647
|
+
import json # pylint: disable=import-outside-toplevel
|
|
648
|
+
|
|
649
|
+
out = {}
|
|
650
|
+
for item in pairs or []:
|
|
651
|
+
if "=" not in item:
|
|
652
|
+
raise typer.BadParameter(f"--set expects key=value, got {item!r}")
|
|
653
|
+
key, raw = item.split("=", 1)
|
|
654
|
+
try:
|
|
655
|
+
out[key.strip()] = json.loads(raw)
|
|
656
|
+
except ValueError:
|
|
657
|
+
out[key.strip()] = raw
|
|
658
|
+
return out
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
def _print_render(r) -> None:
|
|
662
|
+
mode = getattr(r, "mode", "batch")
|
|
663
|
+
typer.echo(f"job {r.job_dir} ({r.seconds:.0f} s, AEDT {mode} pid {r.pid}, {'ok' if r.ok else 'FAILED'})")
|
|
664
|
+
if getattr(r, "note", ""):
|
|
665
|
+
typer.echo(f"note: {r.note}")
|
|
666
|
+
typer.echo(f"project {r.project}")
|
|
667
|
+
for line in r.status:
|
|
668
|
+
typer.echo(f" {line}")
|
|
669
|
+
for k, v in r.summary.items():
|
|
670
|
+
typer.echo(f" {k}: {v}")
|
|
671
|
+
for key in ("cmatrix", "eigenmodes", "sparams"):
|
|
672
|
+
if key in r.results:
|
|
673
|
+
typer.echo(f" results.{key}: {r.results[key]}")
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
@hfss_app.command("render")
|
|
677
|
+
def hfss_render(
|
|
678
|
+
design: Path,
|
|
679
|
+
group: str = typer.Option("chip", "--group", "-g", help="'chip' (whole chip) or a sim_groups name"),
|
|
680
|
+
analysis: str = typer.Option(
|
|
681
|
+
"eigenmode_epr", "--analysis", "-a", help="eigenmode_epr (default) | hfss_eigenmode | q3d_cmatrix | hfss_driven"
|
|
682
|
+
),
|
|
683
|
+
out: Path = typer.Option(None, "-o", help="Job directory (default build/jobs/<sim name>)"),
|
|
684
|
+
solve: bool = typer.Option(False, help="Also solve (qcc_solve.py in a new non-graphical AEDT) and collect results"),
|
|
685
|
+
settings: list[str] = typer.Option(
|
|
686
|
+
None,
|
|
687
|
+
"--set",
|
|
688
|
+
help="Solver setting key=value (JSON value), repeatable, e.g. --set percent_error=1 "
|
|
689
|
+
'--set mesh_size={"1t1_gap":10}',
|
|
690
|
+
),
|
|
691
|
+
airbridges: bool = typer.Option(
|
|
692
|
+
None,
|
|
693
|
+
"--airbridges/--no-airbridges",
|
|
694
|
+
help="Keep airbridges in the simulated geometry (default: the group's setting, else dropped)",
|
|
695
|
+
),
|
|
696
|
+
timeout: float = typer.Option(None, help="Seconds before qcc kills the AEDT process tree it started"),
|
|
697
|
+
open_gui: bool = typer.Option(False, "--open", help="Open the rendered project in a new AEDT GUI"),
|
|
698
|
+
graphical: bool = typer.Option(False, help="Run the render with the AEDT window instead of -ng"),
|
|
699
|
+
aedt: str = typer.Option(
|
|
700
|
+
None, "--aedt", help="batch (new -ng AEDT, default) | gui (new AEDT window, left open) | attach (the open AEDT)"
|
|
701
|
+
),
|
|
702
|
+
show: bool = typer.Option(False, help="Also send the chip to KLayout via klive"),
|
|
703
|
+
dry_run: bool = typer.Option(False, help="Export the job and print the AEDT command only"),
|
|
704
|
+
):
|
|
705
|
+
"""Render DESIGN (whole chip or a sim group) into an AEDT project: geometry, stack, ports, Lj boundaries."""
|
|
706
|
+
from quantcore_circuits.sim_tools import hfss # pylint: disable=import-outside-toplevel
|
|
707
|
+
|
|
708
|
+
cfg = _settings(settings)
|
|
709
|
+
if show:
|
|
710
|
+
from quantcore_circuits.assembly import show as show_design # pylint: disable=import-outside-toplevel
|
|
711
|
+
|
|
712
|
+
typer.echo(f"klive: {show_design(design)}")
|
|
713
|
+
if dry_run:
|
|
714
|
+
from quantcore_circuits.sim_tools import build_simulation, export_job # pylint: disable=C0415
|
|
715
|
+
|
|
716
|
+
setup = build_simulation(design, group, analysis, airbridges=airbridges)
|
|
717
|
+
job = export_job(setup, out or Path("build") / "jobs" / setup.simulation.name, overwrite=True, **cfg)
|
|
718
|
+
try:
|
|
719
|
+
typer.echo(" ".join(hfss.render_command(job, graphical=graphical)))
|
|
720
|
+
except FileNotFoundError as e:
|
|
721
|
+
typer.echo(f"job {job}")
|
|
722
|
+
typer.echo(str(e))
|
|
723
|
+
return
|
|
724
|
+
r = hfss.render(
|
|
725
|
+
design,
|
|
726
|
+
group,
|
|
727
|
+
analysis,
|
|
728
|
+
job_dir=out,
|
|
729
|
+
solve=solve,
|
|
730
|
+
open_gui=open_gui,
|
|
731
|
+
graphical=graphical,
|
|
732
|
+
timeout=timeout,
|
|
733
|
+
airbridges=airbridges,
|
|
734
|
+
aedt=aedt,
|
|
735
|
+
**cfg,
|
|
736
|
+
)
|
|
737
|
+
_print_render(r)
|
|
738
|
+
if not r.ok:
|
|
739
|
+
raise typer.Exit(1)
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
@hfss_app.command("solve")
|
|
743
|
+
def hfss_solve(
|
|
744
|
+
job: Path,
|
|
745
|
+
timeout: float = typer.Option(None, help="Seconds before qcc kills the AEDT process tree it started"),
|
|
746
|
+
graphical: bool = typer.Option(False, help="Run with the AEDT window instead of -ng"),
|
|
747
|
+
aedt: str = typer.Option(
|
|
748
|
+
None, "--aedt", help="batch (new -ng AEDT, default) | gui (new AEDT window, left open) | attach (the open AEDT)"
|
|
749
|
+
),
|
|
750
|
+
):
|
|
751
|
+
"""Solve an exported Ansys JOB directory (new batch AEDT, a new window or the open AEDT) and collect results."""
|
|
752
|
+
from quantcore_circuits.sim_tools import hfss # pylint: disable=import-outside-toplevel
|
|
753
|
+
|
|
754
|
+
r = hfss.solve_job(job, timeout=timeout, graphical=graphical, aedt=aedt)
|
|
755
|
+
_print_render(r)
|
|
756
|
+
if not r.ok:
|
|
757
|
+
raise typer.Exit(1)
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
@hfss_app.command("check")
|
|
761
|
+
def hfss_check(job: Path):
|
|
762
|
+
"""Read JOB's rendered .aedt back: stack, metal sheets, ports / terminations, nets and every solver setting."""
|
|
763
|
+
from quantcore_circuits.sim_tools import hfss # pylint: disable=import-outside-toplevel
|
|
764
|
+
|
|
765
|
+
report = hfss.check_project(job)
|
|
766
|
+
for c in report["checks"]:
|
|
767
|
+
typer.echo(f"{'ok ' if c['ok'] else 'BAD'} {c['check']} {c['detail']}")
|
|
768
|
+
for row in report["settings"]:
|
|
769
|
+
mark = {True: "ok ", False: "BAD", None: " - "}[row["ok"]]
|
|
770
|
+
typer.echo(f"{mark} setting {row['key']} = {row['expected']!r} found {row['found']!r} ({row['where']})")
|
|
771
|
+
typer.echo("OK" if report["ok"] else "FAILED")
|
|
772
|
+
if not report["ok"]:
|
|
773
|
+
raise typer.Exit(1)
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
@hfss_app.command("collect")
|
|
777
|
+
def hfss_collect(
|
|
778
|
+
job: Path,
|
|
779
|
+
aedt: str = typer.Option("batch", "--aedt", help="batch (a new non-graphical AEDT, default) | gui (a new window)"),
|
|
780
|
+
):
|
|
781
|
+
"""Re-export a solved job from its saved project as it is now (no solve), e.g. after you changed the setup in AEDT
|
|
782
|
+
and solved there; then ``qcc results import DESIGN JOB``. Close the project in your own AEDT first, or run
|
|
783
|
+
``scripts/qcc_collect.py`` in that AEDT (Tools > Run Script) instead."""
|
|
784
|
+
from quantcore_circuits.guiflow import convergence_feedback # pylint: disable=import-outside-toplevel
|
|
785
|
+
from quantcore_circuits.sim_tools import hfss # pylint: disable=import-outside-toplevel
|
|
786
|
+
|
|
787
|
+
if aedt not in ("batch", "gui"):
|
|
788
|
+
raise typer.BadParameter("--aedt is batch or gui")
|
|
789
|
+
try:
|
|
790
|
+
r = hfss.collect_job(job, aedt=aedt)
|
|
791
|
+
except FileNotFoundError as e:
|
|
792
|
+
typer.echo(f"error: {e}", err=True)
|
|
793
|
+
raise typer.Exit(1) from e
|
|
794
|
+
typer.echo(f"collected {r.job_dir} in {r.seconds:.0f} s ({'ok' if r.ok else 'FAILED'}; log {r.log})")
|
|
795
|
+
typer.echo(f"mesh: {convergence_feedback(job)['message']}")
|
|
796
|
+
if not r.ok:
|
|
797
|
+
raise typer.Exit(1)
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
@sim_app.command("subset")
|
|
801
|
+
def sim_subset_cmd(
|
|
802
|
+
design: Path,
|
|
803
|
+
instances: str = typer.Option(
|
|
804
|
+
"", "--instances", "-i", help="Components to simulate, comma separated. q3d_cmatrix: qubits and/or their "
|
|
805
|
+
"readout routes (Q1,R1), resonators cut to a stub port; eigenmode / driven: exactly these components (plus the "
|
|
806
|
+
"routes joining them and the pads at a selected line's ends), lines leaving the box end in 50 ohm"
|
|
807
|
+
),
|
|
808
|
+
default: bool = typer.Option(False, "--default", help="No --instances: the first qubit with its readout"),
|
|
809
|
+
whole: bool = typer.Option(False, "--whole", help="The whole chip (slow, memory hungry)"),
|
|
810
|
+
out: Path = typer.Option(None, "-o", help="Job folder (one box) or the folder that holds one job per box"),
|
|
811
|
+
analysis: str = typer.Option(
|
|
812
|
+
"q3d_cmatrix", "--analysis", "-a", help="q3d_cmatrix (cheap, fills the LOM) | eigenmode_epr | "
|
|
813
|
+
"hfss_eigenmode | hfss_driven"
|
|
814
|
+
),
|
|
815
|
+
fast: bool = typer.Option(True, "--fast/--full", help="Fast solver settings (default) or the analysis defaults"),
|
|
816
|
+
margin: float = typer.Option(300.0, help="Margin (um) around the selection"),
|
|
817
|
+
name: str = typer.Option("gui_sim", help="Name of the sim group(s) written into the design"),
|
|
818
|
+
write_group: bool = typer.Option(True, "--write-group/--no-write-group", help="Store the sim group in the design"),
|
|
819
|
+
group: str = typer.Option(None, "--group", "-g", help="Export a saved sim_groups entry as it is (writes nothing)"),
|
|
820
|
+
set_: list[str] = typer.Option(None, "--set", help="Solver setting key=value, repeatable (with --full: on top of "
|
|
821
|
+
"the analysis defaults), e.g. --set maximum_passes=12 --set percent_error=1"),
|
|
822
|
+
):
|
|
823
|
+
"""Export the job folder of a subset (no solve): geometry, AEDT scripts, job.json, README.md (what to run and
|
|
824
|
+
what to bring back) and results_template.json. Solve it by hand or elsewhere; read it back with ``qcc results
|
|
825
|
+
import``."""
|
|
826
|
+
from quantcore_circuits import guiflow # pylint: disable=import-outside-toplevel
|
|
827
|
+
|
|
828
|
+
try:
|
|
829
|
+
guiflow.export_manual(
|
|
830
|
+
design, [n.strip() for n in instances.split(",") if n.strip()], default, whole, out, analysis, name,
|
|
831
|
+
margin, fast, write_group, say=typer.echo, settings=_settings(set_), group=group,
|
|
832
|
+
)
|
|
833
|
+
except (ValueError, FileExistsError) as e:
|
|
834
|
+
typer.echo(f"error: {e}", err=True)
|
|
835
|
+
raise typer.Exit(1) from e
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
@sim_app.command("preview")
|
|
839
|
+
def sim_preview_cmd(
|
|
840
|
+
design: Path,
|
|
841
|
+
instances: str = typer.Option("", "--instances", "-i", help="Components, as for `qcc sim subset`"),
|
|
842
|
+
default: bool = typer.Option(False, "--default", help="No --instances: the first qubit with its readout"),
|
|
843
|
+
whole: bool = typer.Option(False, "--whole", help="The whole chip"),
|
|
844
|
+
group: str = typer.Option(None, "--group", "-g", help="A saved sim_groups entry, as it is"),
|
|
845
|
+
analysis: str = typer.Option(None, "--analysis", "-a", help="Default q3d_cmatrix; with --group the group's first"),
|
|
846
|
+
margin: float = typer.Option(300.0, help="Margin (um) around the selection"),
|
|
847
|
+
name: str = typer.Option("gui_sim", help="Name of the sim group(s) the export would write"),
|
|
848
|
+
):
|
|
849
|
+
"""Print as JSON what `qcc sim subset` would render (no file is written): the box, the components and routes in it
|
|
850
|
+
and every port (50 ohm edge ports, cut stubs, junction ports) with its position. The KLayout plugin draws it."""
|
|
851
|
+
import json # pylint: disable=import-outside-toplevel
|
|
852
|
+
|
|
853
|
+
from quantcore_circuits import guiflow # pylint: disable=import-outside-toplevel
|
|
854
|
+
|
|
855
|
+
try:
|
|
856
|
+
out = guiflow.preview_groups(
|
|
857
|
+
design, [n.strip() for n in instances.split(",") if n.strip()], default, whole,
|
|
858
|
+
analysis or (None if group else "q3d_cmatrix"), margin, name, group,
|
|
859
|
+
)
|
|
860
|
+
except (ValueError, FileNotFoundError) as e:
|
|
861
|
+
typer.echo(f"error: {e}", err=True)
|
|
862
|
+
raise typer.Exit(1) from e
|
|
863
|
+
typer.echo(json.dumps(out))
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
@sim_app.command("auto")
|
|
867
|
+
def sim_auto_cmd(
|
|
868
|
+
design: Path,
|
|
869
|
+
instances: str = typer.Option("", "--instances", "-i", help="Qubits and/or readout routes, comma separated"),
|
|
870
|
+
default: bool = typer.Option(False, "--default", help="No --instances: the first qubit with its readout"),
|
|
871
|
+
whole: bool = typer.Option(False, "--whole", help="The whole chip (slow, memory hungry)"),
|
|
872
|
+
analysis: str = typer.Option("q3d_cmatrix", "--analysis", "-a"),
|
|
873
|
+
aedt: str = typer.Option("batch", "--aedt", help="batch (a new non-graphical AEDT, default) | gui (a new window)"),
|
|
874
|
+
fast: bool = typer.Option(True, "--fast/--full", help="Fast solver settings (default)"),
|
|
875
|
+
margin: float = typer.Option(300.0, help="Margin (um) around the selection"),
|
|
876
|
+
name: str = typer.Option("gui_sim", help="Name of the sim group(s) written into the design"),
|
|
877
|
+
timeout: float = typer.Option(3600.0, help="Seconds per solve before qcc stops the AEDT it started"),
|
|
878
|
+
status: Path = typer.Option(None, help="Status file (JSON) the KLayout plugin polls"),
|
|
879
|
+
set_: list[str] = typer.Option(None, "--set", help="Solver setting key=value, repeatable (with --full: on top of "
|
|
880
|
+
"the analysis defaults), e.g. --set maximum_passes=12 --set percent_error=1"),
|
|
881
|
+
):
|
|
882
|
+
"""Automatic simulation: subset -> export -> solve in a NEW AEDT (never the one you have open) -> analyse. Fills
|
|
883
|
+
the LOM of the simulated components; ``qcc analyse`` / the KLayout Results tab show it against the targets."""
|
|
884
|
+
from quantcore_circuits import guiflow # pylint: disable=import-outside-toplevel
|
|
885
|
+
|
|
886
|
+
if aedt not in ("batch", "gui"):
|
|
887
|
+
raise typer.BadParameter("--aedt is batch or gui (qcc sim auto never attaches to a window you have open)")
|
|
888
|
+
try:
|
|
889
|
+
out = guiflow.run_auto(
|
|
890
|
+
design, [n.strip() for n in instances.split(",") if n.strip()], default, whole, analysis, name, margin,
|
|
891
|
+
aedt, fast, timeout, status, say=typer.echo, settings=_settings(set_),
|
|
892
|
+
)
|
|
893
|
+
except Exception as e: # noqa: BLE001
|
|
894
|
+
typer.echo(f"error: {type(e).__name__}: {e}", err=True)
|
|
895
|
+
raise typer.Exit(1) from e
|
|
896
|
+
typer.echo(f"done in {out['seconds']:.0f} s: {out['summary']}")
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
@sim_app.command("run")
|
|
900
|
+
def sim_run(job: Path, dry_run: bool = typer.Option(False, help="Only print the command")):
|
|
901
|
+
"""Run a job locally (AEDT / Elmer / Palace) and collect results."""
|
|
902
|
+
from quantcore_circuits.sim_tools.runner import job_summary, run_job # pylint: disable=import-outside-toplevel
|
|
903
|
+
|
|
904
|
+
res = run_job(job, dry_run=dry_run)
|
|
905
|
+
typer.echo(" ".join(res["command"]) if dry_run else job_summary(job))
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
@sim_app.command("submit")
|
|
909
|
+
def sim_submit(job: Path, queue: Path = typer.Option(..., help="Queue directory")):
|
|
910
|
+
from quantcore_circuits.sim_tools.runner import submit # pylint: disable=import-outside-toplevel
|
|
911
|
+
|
|
912
|
+
typer.echo(f"queued {submit(job, queue)}")
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
@runner_app.command("serve")
|
|
916
|
+
def runner_serve(queue: Path, poll: float = 5.0, once: bool = False):
|
|
917
|
+
"""Process the filesystem queue (run on the lab server)."""
|
|
918
|
+
from quantcore_circuits.sim_tools.runner import serve # pylint: disable=import-outside-toplevel
|
|
919
|
+
|
|
920
|
+
serve(queue, poll=poll, once=once)
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
@runner_app.command("status")
|
|
924
|
+
def runner_status(queue: Path):
|
|
925
|
+
from quantcore_circuits.sim_tools.runner import queue_status # pylint: disable=import-outside-toplevel
|
|
926
|
+
|
|
927
|
+
typer.echo(json.dumps(queue_status(queue), indent=2))
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
# ---- results ------------------------------------------------------------------------------------------------------
|
|
931
|
+
@app.command()
|
|
932
|
+
def analyse(
|
|
933
|
+
design: Path,
|
|
934
|
+
job: Path,
|
|
935
|
+
group: str = typer.Option(None, "--group", "-g", help="Sim group (default: the job's)"),
|
|
936
|
+
run_dir: Path = typer.Option(None, help="Dashboard run directory (default build/<design name>)"),
|
|
937
|
+
readout: bool = typer.Option(True, help="Simulate the readout (χ from transmission) with QuTiP"),
|
|
938
|
+
propose: bool = typer.Option(False, "--feedback", help="Also propose the next design revision (surrogate)"),
|
|
939
|
+
):
|
|
940
|
+
"""Job results → circuit.json → Metal LOM / QuCat / SQcircuit / scqubits / QuTiP → consensus vs targets."""
|
|
941
|
+
from quantcore_circuits import loop # pylint: disable=import-outside-toplevel
|
|
942
|
+
from quantcore_circuits.circuit.consensus import report_markdown # pylint: disable=import-outside-toplevel
|
|
943
|
+
from quantcore_circuits.track import Run # pylint: disable=import-outside-toplevel
|
|
944
|
+
|
|
945
|
+
run = Run(design, run_dir)
|
|
946
|
+
an = loop.analyse(design, job, group, run=run, readout=readout, out_dir=run.dir)
|
|
947
|
+
typer.echo(report_markdown(an.rows, f"Consensus {an.model.name}"))
|
|
948
|
+
for note in an.filled.notes:
|
|
949
|
+
typer.echo(f"note: {note}")
|
|
950
|
+
if an.readout:
|
|
951
|
+
typer.echo(
|
|
952
|
+
f"readout chi {an.readout['chi_readout_MHz']:.4f} MHz vs eigen {an.readout['chi_eigen_MHz']:.4f} MHz"
|
|
953
|
+
)
|
|
954
|
+
typer.echo(f"goal: {an.goal['summary']} (dashboard state: {run.path})")
|
|
955
|
+
if propose:
|
|
956
|
+
prop, rev, _ = loop.feedback(an, run, design)
|
|
957
|
+
typer.echo(f"proposed {rev}: " + ", ".join(f"{k}={v:g}" for k, v in prop.knobs.items()))
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
@results_app.command("collect")
|
|
961
|
+
def results_collect(job: Path):
|
|
962
|
+
"""Parse solver outputs in JOB into results/results.json."""
|
|
963
|
+
from quantcore_circuits.analysis.results import collect_results # pylint: disable=import-outside-toplevel
|
|
964
|
+
|
|
965
|
+
res = collect_results(job)
|
|
966
|
+
typer.echo(json.dumps({k: v for k, v in res.items() if k != "raw_files"}, indent=2)[:4000])
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
@results_app.command("extract")
|
|
970
|
+
def results_extract(design: Path, job: Path, store: Path = typer.Option(None, help="Results store (sqlite)")):
|
|
971
|
+
"""Extract Hamiltonian parameters from JOB results and compare with design targets."""
|
|
972
|
+
from quantcore_circuits.analysis.extract import compare, extract # pylint: disable=import-outside-toplevel
|
|
973
|
+
from quantcore_circuits.analysis.results import collect_results # pylint: disable=import-outside-toplevel
|
|
974
|
+
from quantcore_circuits.design import load_design # pylint: disable=import-outside-toplevel
|
|
975
|
+
|
|
976
|
+
d = load_design(design)
|
|
977
|
+
res = collect_results(job)
|
|
978
|
+
params = extract(d, res)
|
|
979
|
+
for row in compare(d.targets, params):
|
|
980
|
+
err = "" if row["error"] is None else f"{row['error']:+.4g}"
|
|
981
|
+
typer.echo(
|
|
982
|
+
f" {row['instance']:6s} {row['quantity']:12s} target {row['target']:<10g} "
|
|
983
|
+
f"got {row['value'] if row['value'] is not None else '-'!s:<22} {err}"
|
|
984
|
+
)
|
|
985
|
+
if store:
|
|
986
|
+
from quantcore_circuits.analysis.store import ResultsStore # pylint: disable=import-outside-toplevel
|
|
987
|
+
|
|
988
|
+
rid = ResultsStore(store).put(
|
|
989
|
+
res["design_hash"], res["group"], res["analysis"], params, design=d.name, job_dir=job
|
|
990
|
+
)
|
|
991
|
+
typer.echo(f"stored as #{rid} in {store}")
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
@results_app.command("import")
|
|
995
|
+
def results_import_cmd(
|
|
996
|
+
design: Path,
|
|
997
|
+
sources: list[Path] = typer.Argument(..., help="Solved job folder(s) or results.json file(s)"),
|
|
998
|
+
group: str = typer.Option(None, "--group", "-g", help="Sim group the results belong to (default: from the job)"),
|
|
999
|
+
):
|
|
1000
|
+
"""Read solved results back (a job folder, its results/ folder or a results.json: format in `qcc results
|
|
1001
|
+
template --format`), check them against the design and analyse them (the KLayout Results tab shows the outcome)."""
|
|
1002
|
+
from quantcore_circuits import guiflow # pylint: disable=import-outside-toplevel
|
|
1003
|
+
|
|
1004
|
+
try:
|
|
1005
|
+
out = guiflow.import_results(design, sources, group, say=typer.echo)
|
|
1006
|
+
except ValueError as e:
|
|
1007
|
+
typer.echo(f"error: {e}", err=True)
|
|
1008
|
+
raise typer.Exit(1) from e
|
|
1009
|
+
typer.echo(f"imported: {out['summary']}")
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
@results_app.command("template")
|
|
1013
|
+
def results_template_cmd(
|
|
1014
|
+
design: Path,
|
|
1015
|
+
out: Path = typer.Option(None, "-o", help="Write the skeleton here (default: print it)"),
|
|
1016
|
+
group: str = typer.Option("chip", "--group", "-g"),
|
|
1017
|
+
analysis: str = typer.Option("q3d_cmatrix", "--analysis", "-a"),
|
|
1018
|
+
show_format: bool = typer.Option(False, "--format", help="Print the results.json format description instead"),
|
|
1019
|
+
):
|
|
1020
|
+
"""A results.json skeleton with this design's net names (with --format: the format description)."""
|
|
1021
|
+
from quantcore_circuits import guiflow # pylint: disable=import-outside-toplevel
|
|
1022
|
+
|
|
1023
|
+
if show_format:
|
|
1024
|
+
typer.echo(guiflow.RESULTS_FORMAT)
|
|
1025
|
+
return
|
|
1026
|
+
text = json.dumps(guiflow.results_template(design, group, analysis), indent=2)
|
|
1027
|
+
if out:
|
|
1028
|
+
Path(out).write_text(text + "\n", encoding="utf-8")
|
|
1029
|
+
typer.echo(f"wrote {out}")
|
|
1030
|
+
else:
|
|
1031
|
+
typer.echo(text)
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
@results_app.command("propose")
|
|
1035
|
+
def results_propose_cmd(
|
|
1036
|
+
design: Path,
|
|
1037
|
+
job: list[Path] = typer.Option(
|
|
1038
|
+
None, "--job", help="Job folder(s) to analyse (default: the last run's, else the layout estimates)"
|
|
1039
|
+
),
|
|
1040
|
+
out: Path = typer.Option(None, "-o", help="Write the proposal (JSON) here"),
|
|
1041
|
+
):
|
|
1042
|
+
"""Propose the next design revision (loop.feedback: every qubit with a LOM model and a lambda/4 or lambda/2
|
|
1043
|
+
readout) as old -> new knob values; nothing is written to the design. ``qcc results apply`` sets them."""
|
|
1044
|
+
from quantcore_circuits import guiflow # pylint: disable=import-outside-toplevel
|
|
1045
|
+
|
|
1046
|
+
res = guiflow.propose(design, list(job) if job else None, out, say=typer.echo)
|
|
1047
|
+
typer.echo(f"basis: {res['basis']}")
|
|
1048
|
+
for k in res["knobs"]:
|
|
1049
|
+
typer.echo(f" {k['knob']}: {k['old']:g} -> {k['new']:g}")
|
|
1050
|
+
for k in res["moved"]:
|
|
1051
|
+
typer.echo(f" also moves {k['path']}: {k['old']} -> {k['new']}")
|
|
1052
|
+
for note in res.get("notes", []):
|
|
1053
|
+
typer.echo(f" not tuned: {note}")
|
|
1054
|
+
typer.echo(res["message"])
|
|
1055
|
+
|
|
1056
|
+
|
|
1057
|
+
@results_app.command("apply")
|
|
1058
|
+
def results_apply_cmd(
|
|
1059
|
+
design: Path,
|
|
1060
|
+
proposal: Path = typer.Argument(..., help="proposal.json from `qcc results propose -o`"),
|
|
1061
|
+
out: Path = typer.Option(None, "-o", help="Write the new design here (default: overwrite DESIGN)"),
|
|
1062
|
+
):
|
|
1063
|
+
"""DESIGN with the proposal's knobs set (refuses when the design changed since the proposal)."""
|
|
1064
|
+
from quantcore_circuits import guiflow # pylint: disable=import-outside-toplevel
|
|
1065
|
+
|
|
1066
|
+
try:
|
|
1067
|
+
guiflow.apply_knobs(design, json.loads(Path(proposal).read_text(encoding="utf-8")), out or design)
|
|
1068
|
+
except ValueError as e:
|
|
1069
|
+
typer.echo(f"error: {e}", err=True)
|
|
1070
|
+
raise typer.Exit(1) from e
|
|
1071
|
+
typer.echo(f"wrote {out or design}")
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
@results_app.command("show")
|
|
1075
|
+
def results_show(design: Path, store: Path = typer.Option(Path("results.sqlite"))):
|
|
1076
|
+
from quantcore_circuits.analysis.store import ResultsStore # pylint: disable=import-outside-toplevel
|
|
1077
|
+
from quantcore_circuits.design import design_hash, load_design # pylint: disable=import-outside-toplevel
|
|
1078
|
+
|
|
1079
|
+
d = load_design(design)
|
|
1080
|
+
for row in ResultsStore(store).query(design_hash=design_hash(d)):
|
|
1081
|
+
typer.echo(f"#{row['id']} {row['created']} {row['group']}/{row['analysis']}: {json.dumps(row['data'])}")
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
if __name__ == "__main__":
|
|
1085
|
+
app()
|