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,828 @@
|
|
|
1
|
+
"""Fill a :class:`CircuitModel` with element values (M9): component estimates, FEM results, design values.
|
|
2
|
+
|
|
3
|
+
Each branch carries three numbers side by side, never overwriting one another:
|
|
4
|
+
|
|
5
|
+
* ``estimate`` — from the layout's LOM (component calibration, CPW formulas, coupled-line κ),
|
|
6
|
+
* ``extracted`` — from a simulation (C-matrix nets matched to node islands), when a job is given,
|
|
7
|
+
* ``design`` — what the design asked for (LOM synthesis of the targets).
|
|
8
|
+
|
|
9
|
+
The *chosen* value is ``extracted`` when present, else ``estimate``; estimators always use the chosen value, so the
|
|
10
|
+
same analysis runs on a circuit exported from KLayout (estimates only) and on one filled from HFSS/Q3D.
|
|
11
|
+
|
|
12
|
+
Stack correction: if the job was simulated on another substrate than the design's PDK (e.g. an old silicon run of
|
|
13
|
+
a design that moved to sapphire), capacitances are rescaled by (εr,design + 1)/(εr,job + 1) and a note says so.
|
|
14
|
+
A cut coupler port's CPW stub is removed from the pad capacitance (it is part of the routed λ/4 length).
|
|
15
|
+
|
|
16
|
+
Subsets (phase C, :mod:`quantcore_circuits.sim_tools.subset`): a job fills only the branches *owned* by the components
|
|
17
|
+
its sim group selected (a branch's owner is the instance or route that put it in the netlist; a declared coupling is
|
|
18
|
+
owned by both ends and needs both ends chosen, or one end on a feedline). Every other branch keeps its estimate and
|
|
19
|
+
its ``source`` says it was outside the subset. ``fill(model, design, [job_a, job_b])`` merges several subset jobs into
|
|
20
|
+
one whole-chip circuit; each branch's ``source`` names the job it came from (``cmatrix:<simulation>``). Two more
|
|
21
|
+
read-back rules apply to every job:
|
|
22
|
+
|
|
23
|
+
* **line nets** — a C-matrix net that carries a distributed line (a route the box cuts, labelled with the route's name,
|
|
24
|
+
or a route the job keeps whole, e.g. the whole-chip ``chip`` group) has the line's own capacitance in its row sum,
|
|
25
|
+
which the LOM already models as a transmission line: its branches to ground keep their estimates (a note says so),
|
|
26
|
+
its mutual capacitances are taken from the FEM. This is the fix for tutorial 02's whole-chip readouts (f_r −49 %:
|
|
27
|
+
a λ/2 line's ≈ 1060 fF landed on a lumped branch).
|
|
28
|
+
* **one FEM value, several branches** — branches on the same node pair (e.g. a capacitor pad and the qubit's readout
|
|
29
|
+
pad on one node, both to ground) share the FEM value in proportion to their estimates, instead of each getting the
|
|
30
|
+
whole of it.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
from __future__ import annotations
|
|
34
|
+
|
|
35
|
+
import json
|
|
36
|
+
from dataclasses import dataclass, field
|
|
37
|
+
from pathlib import Path
|
|
38
|
+
|
|
39
|
+
import numpy as np
|
|
40
|
+
|
|
41
|
+
from quantcore_circuits import track as _track
|
|
42
|
+
|
|
43
|
+
from quantcore_circuits.circuit.bridges import (
|
|
44
|
+
branch_capacitances,
|
|
45
|
+
quarter_wave_lc,
|
|
46
|
+
stack_capacitance_scale,
|
|
47
|
+
tl_resonator,
|
|
48
|
+
)
|
|
49
|
+
from quantcore_circuits.circuit.schema import CircuitModel
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@dataclass
|
|
53
|
+
class BranchValue:
|
|
54
|
+
type: str
|
|
55
|
+
nodes: tuple[str, str]
|
|
56
|
+
unit: str
|
|
57
|
+
extracted: float | None = None
|
|
58
|
+
design: float | None = None
|
|
59
|
+
source: str = ""
|
|
60
|
+
extra: dict = field(default_factory=dict)
|
|
61
|
+
estimate: float | None = None
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def value(self) -> float | None:
|
|
65
|
+
"""Chosen value: FEM if available, else the component estimate."""
|
|
66
|
+
return self.extracted if self.extracted is not None else self.estimate
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def origin(self) -> str:
|
|
70
|
+
return "fem" if self.extracted is not None else ("estimate" if self.estimate is not None else "none")
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@dataclass
|
|
74
|
+
class TransmonReadout:
|
|
75
|
+
"""Everything the estimator adapters need for one grounded transmon + λ/4 readout pair."""
|
|
76
|
+
|
|
77
|
+
qubit: str
|
|
78
|
+
resonator: str
|
|
79
|
+
labels: list[str] # [island net, coupler net]
|
|
80
|
+
cmatrix_fF: np.ndarray # 2×2 Maxwell sub-matrix for those nets
|
|
81
|
+
lj_nH: float
|
|
82
|
+
cj_fF: float
|
|
83
|
+
f_r_GHz: float # bare λ/4 frequency from the routed length (CPW model)
|
|
84
|
+
z0_ohm: float
|
|
85
|
+
ck_fF: float | None = None
|
|
86
|
+
feedline: str | None = None
|
|
87
|
+
asym: float = 0.0
|
|
88
|
+
flux_phi0: float = 0.0 # lj_nH is the SQUID's L at this flux; lj0_nH its zero-flux value
|
|
89
|
+
squid: bool = False
|
|
90
|
+
kappa_MHz: float | None = None # external linewidth (hanger estimate or simulation)
|
|
91
|
+
kind: str = "lambda/4" # readout line: "lambda/4" or "lambda/2" (f_r_GHz is that mode's frequency)
|
|
92
|
+
lj0_nH: float | None = None # a flux-biased SQUID's L_J at zero flux (None: lj_nH)
|
|
93
|
+
|
|
94
|
+
@property
|
|
95
|
+
def ej_sum_ratio(self) -> float:
|
|
96
|
+
"""E_J(Φ = 0) / E_J at the bias, = L(Φ) / L_J0 (1 without a flux bias): scales an E_J to the SQUID's sum."""
|
|
97
|
+
return self.lj_nH / self.lj0_nH if self.lj0_nH else 1.0
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def c_island_fF(self) -> float: # island → ground (incl. junction capacitance)
|
|
101
|
+
return float(self.cmatrix_fF[0].sum()) + self.cj_fF
|
|
102
|
+
|
|
103
|
+
@property
|
|
104
|
+
def cg_fF(self) -> float:
|
|
105
|
+
return float(-self.cmatrix_fF[0, 1])
|
|
106
|
+
|
|
107
|
+
@property
|
|
108
|
+
def c_coupler_fF(self) -> float: # coupler pad → ground (without the resonator)
|
|
109
|
+
return float(self.cmatrix_fF[1].sum())
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@dataclass
|
|
113
|
+
class FilledCircuit:
|
|
114
|
+
model: CircuitModel
|
|
115
|
+
design: object
|
|
116
|
+
values: dict[str, BranchValue]
|
|
117
|
+
cmatrix: dict | None
|
|
118
|
+
pairs: list[TransmonReadout]
|
|
119
|
+
job: str | None = None
|
|
120
|
+
notes: list[str] = field(default_factory=list)
|
|
121
|
+
# the job's results.json (sim agent, additive): estimators that read solver output directly, e.g. pyEPR on
|
|
122
|
+
# eigenmode data (``results["epr"]``, ``results["eigenmodes"]``, ``results["sparams"]``)
|
|
123
|
+
results: dict = field(default_factory=dict)
|
|
124
|
+
# subset read-back (phase C, additive): one entry per job used, {"job", "group", "analysis", "scope", "filled",
|
|
125
|
+
# "results"}; ``scope`` the components it may fill (None: all), ``filled`` the branches it did fill
|
|
126
|
+
jobs: list[dict] = field(default_factory=list)
|
|
127
|
+
|
|
128
|
+
def branch_table(self) -> list[dict]:
|
|
129
|
+
rows = []
|
|
130
|
+
for name, v in self.values.items():
|
|
131
|
+
delta = None
|
|
132
|
+
if v.value is not None and v.design:
|
|
133
|
+
delta = 100 * (v.value - v.design) / abs(v.design)
|
|
134
|
+
rows.append(
|
|
135
|
+
{
|
|
136
|
+
"branch": name,
|
|
137
|
+
"type": v.type,
|
|
138
|
+
"nodes": list(v.nodes),
|
|
139
|
+
"extracted": v.extracted,
|
|
140
|
+
"estimate": v.estimate,
|
|
141
|
+
"value": v.value,
|
|
142
|
+
"origin": v.origin,
|
|
143
|
+
"design": v.design,
|
|
144
|
+
"unit": v.unit,
|
|
145
|
+
"delta_pct": delta,
|
|
146
|
+
"source": v.source,
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
return rows
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def load_results(job_or_results) -> tuple[dict, dict | None]:
|
|
153
|
+
"""(results.json dict, job.json dict or None) from a job directory, results file or dict."""
|
|
154
|
+
if isinstance(job_or_results, dict):
|
|
155
|
+
return job_or_results, None
|
|
156
|
+
p = Path(job_or_results)
|
|
157
|
+
if p.is_dir():
|
|
158
|
+
res = json.loads((p / "results" / "results.json").read_text(encoding="utf-8"))
|
|
159
|
+
job = json.loads((p / "job.json").read_text(encoding="utf-8")) if (p / "job.json").exists() else None
|
|
160
|
+
return res, job
|
|
161
|
+
return json.loads(p.read_text(encoding="utf-8")), None
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def _job_permittivity(job: dict | None) -> float | None:
|
|
165
|
+
if not job:
|
|
166
|
+
return None
|
|
167
|
+
from quantcore_circuits.pdk import get_pdk # pylint: disable=import-outside-toplevel
|
|
168
|
+
|
|
169
|
+
name = job.get("versions", {}).get("pdk", "").split("@", 1)[0]
|
|
170
|
+
try:
|
|
171
|
+
return get_pdk(name).stack.substrate_permittivity
|
|
172
|
+
except ValueError:
|
|
173
|
+
return None
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def _synthesis(model: CircuitModel, design, pdk) -> dict:
|
|
177
|
+
from quantcore_circuits.analysis.synthesis import synthesize_transmon_readout # pylint: disable=C0415
|
|
178
|
+
|
|
179
|
+
out = {}
|
|
180
|
+
for rname, b in model.branches.items():
|
|
181
|
+
if b.type != "TLres":
|
|
182
|
+
continue
|
|
183
|
+
q = b.nodes[0].split(".", 1)[0]
|
|
184
|
+
tq, tr = design.targets.get(q, {}), design.targets.get(rname, {})
|
|
185
|
+
if {"f_q_GHz", "alpha_MHz"} <= set(tq) and {"f_GHz", "g_MHz"} <= set(tr):
|
|
186
|
+
out[q] = synthesize_transmon_readout(
|
|
187
|
+
tq["f_q_GHz"], tq["alpha_MHz"], tr["f_GHz"], tr["g_MHz"], pdk.cpw_a, pdk.cpw_b, design.pdk
|
|
188
|
+
)
|
|
189
|
+
return out
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def _merge_node_nets(model, labels: list[str], matrix: np.ndarray, extra: dict[str, list[str]] | None = None
|
|
193
|
+
) -> tuple[list[str], np.ndarray, dict[str, str]]:
|
|
194
|
+
"""Sum the Maxwell rows / columns of C-matrix nets that belong to one circuit node (e.g. a λ/2 readout modelled as
|
|
195
|
+
one parallel-LC node: its pad at the qubit and its pad at the coupling capacitor are both nets of a box that cuts
|
|
196
|
+
the line at both ends; tutorial 02 ``Q2_read``). Without this the node took whichever net came first — the far
|
|
197
|
+
capacitor pad — and the qubit's readout coupling came out as 0.002 fF. Returns (labels, matrix, {merged: kept})."""
|
|
198
|
+
index = {lab: i for i, lab in enumerate(labels)}
|
|
199
|
+
groups: list[list[int]] = []
|
|
200
|
+
seen: set[int] = set()
|
|
201
|
+
merged: dict[str, str] = {}
|
|
202
|
+
for name, spec in model.nodes.items():
|
|
203
|
+
if name == model.ground or spec.ground:
|
|
204
|
+
continue
|
|
205
|
+
nets = list(spec.nets) + list((extra or {}).get(name, []))
|
|
206
|
+
idx = [index[n] for n in nets if n in index and index[n] not in seen]
|
|
207
|
+
if len(idx) > 1:
|
|
208
|
+
groups.append(idx)
|
|
209
|
+
seen.update(idx)
|
|
210
|
+
merged.update({labels[i]: labels[idx[0]] for i in idx[1:]})
|
|
211
|
+
if not groups:
|
|
212
|
+
return labels, matrix, {}
|
|
213
|
+
keep = [i for i in range(len(labels)) if i not in seen or any(i == g[0] for g in groups)]
|
|
214
|
+
rows = {i: [i] for i in keep}
|
|
215
|
+
for g in groups:
|
|
216
|
+
rows[g[0]] = g
|
|
217
|
+
agg = np.zeros((len(keep), len(labels)))
|
|
218
|
+
for k, i in enumerate(keep):
|
|
219
|
+
agg[k, rows[i]] = 1.0
|
|
220
|
+
return [labels[i] for i in keep], agg @ matrix @ agg.T, merged
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def fill(
|
|
224
|
+
model: CircuitModel,
|
|
225
|
+
design_source,
|
|
226
|
+
job_or_results=None,
|
|
227
|
+
synthesis: dict | None = None,
|
|
228
|
+
stack_correction: str = "auto",
|
|
229
|
+
scope="auto",
|
|
230
|
+
plan=None,
|
|
231
|
+
) -> FilledCircuit:
|
|
232
|
+
"""Values for every branch of ``model`` (see module docstring); ``job_or_results`` is optional, or a list of jobs
|
|
233
|
+
(subset jobs: each fills its own components, merged into one circuit).
|
|
234
|
+
|
|
235
|
+
``scope``: ``"auto"`` (default) — a job fills only the branches owned by its sim group's selection (all of them for
|
|
236
|
+
the whole-chip ``chip`` group or a bare results dict); ``None`` — every branch whose nodes have FEM nets (the
|
|
237
|
+
behaviour before subsets); or a set of component names.
|
|
238
|
+
|
|
239
|
+
``design_source=None`` fills a stand-alone ``circuit.json`` (e.g. exported from KLayout) from its own stored
|
|
240
|
+
estimates: resonators use their stored f/Z0, no design values. ``plan``: the design's build plan when the caller
|
|
241
|
+
has it already (``plan_for_lom``), so it is not planned again.
|
|
242
|
+
"""
|
|
243
|
+
if design_source is None:
|
|
244
|
+
out = _fill_standalone(model)
|
|
245
|
+
_track.emit("fill", filled=out)
|
|
246
|
+
return out
|
|
247
|
+
jobs = list(job_or_results) if isinstance(job_or_results, (list, tuple)) else [job_or_results]
|
|
248
|
+
if not jobs:
|
|
249
|
+
jobs = [None]
|
|
250
|
+
parts = [_fill_one(model, design_source, j, synthesis, stack_correction, scope, plan) for j in jobs]
|
|
251
|
+
out = parts[0] if len(parts) == 1 else _merge_fills(model, parts)
|
|
252
|
+
_mark_outside(out)
|
|
253
|
+
_track.emit("fill", filled=out)
|
|
254
|
+
return out
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def _copy_value(v: BranchValue) -> BranchValue:
|
|
258
|
+
return BranchValue(v.type, v.nodes, v.unit, v.extracted, v.design, v.source, dict(v.extra), v.estimate)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def _merge_fills(model: CircuitModel, parts: list[FilledCircuit]) -> FilledCircuit:
|
|
262
|
+
"""One circuit from several subset fills: a branch takes the first job that extracted it."""
|
|
263
|
+
base = parts[0]
|
|
264
|
+
values = {k: _copy_value(v) for k, v in base.values.items()}
|
|
265
|
+
notes = list(base.notes)
|
|
266
|
+
for part in parts[1:]:
|
|
267
|
+
notes += [f"[{part.job}] {n}" for n in part.notes]
|
|
268
|
+
for k, v in part.values.items():
|
|
269
|
+
if v.extracted is None:
|
|
270
|
+
continue
|
|
271
|
+
if values[k].extracted is None:
|
|
272
|
+
values[k] = _copy_value(v)
|
|
273
|
+
elif abs(values[k].extracted - v.extracted) > 1e-9:
|
|
274
|
+
notes.append(f"{k}: two subset jobs fill it ({values[k].source} {values[k].extracted:.4g}, "
|
|
275
|
+
f"{v.source} {v.extracted:.4g}); the first is kept")
|
|
276
|
+
pairs = _pairs(model, values, notes)
|
|
277
|
+
first = next((p for p in parts if p.cmatrix), base)
|
|
278
|
+
epr = next((p for p in parts if (p.results or {}).get("epr")), first)
|
|
279
|
+
jobs = [j for p in parts for j in p.jobs]
|
|
280
|
+
name = " + ".join(str(p.job) for p in parts if p.job) or None
|
|
281
|
+
return FilledCircuit(model, base.design, values, first.cmatrix, pairs, name, notes, epr.results, jobs)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def _mark_outside(filled: FilledCircuit) -> None:
|
|
285
|
+
"""Branches no job filled keep their estimate; when a job had a scope (a subset), say so in ``source``."""
|
|
286
|
+
scoped = [j for j in filled.jobs if j.get("scope") is not None]
|
|
287
|
+
if not scoped:
|
|
288
|
+
return
|
|
289
|
+
groups = ", ".join(dict.fromkeys(str(j.get("group")) for j in scoped))
|
|
290
|
+
for name, v in filled.values.items():
|
|
291
|
+
if v.type not in ("C", "HANGER") or v.extracted is not None:
|
|
292
|
+
continue
|
|
293
|
+
if any(name in (j.get("in_scope") or ()) for j in scoped):
|
|
294
|
+
continue # inside a subset, but the FEM had no (physical) value for it: its own note says why
|
|
295
|
+
v.extra = {**v.extra, "subset": "outside"}
|
|
296
|
+
v.source = f"{v.source or 'estimate'} (estimate: outside subset {groups})"
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def branch_owners(model: CircuitModel, design) -> dict[str, set[str]]:
|
|
300
|
+
"""Which design components each branch belongs to: the instance whose LOM model made it (``C_Q1``, ``Cg_Q2_bus``,
|
|
301
|
+
``C_C_Q0_a`` → ``C_Q0``, ``Port_P_Q0`` → ``P_Q0``), the route for a resonator (``R1``) or its hanger
|
|
302
|
+
(``K_R1``), both ends for a declared coupling (``C_<coupling>`` or the coupling's own name). Unknown names fall
|
|
303
|
+
back to the components named by the branch's nodes."""
|
|
304
|
+
import re # pylint: disable=import-outside-toplevel
|
|
305
|
+
|
|
306
|
+
insts = sorted(design.instances, key=len, reverse=True)
|
|
307
|
+
pats = [(i, re.compile(rf"^[A-Za-z]+_{re.escape(i)}(_.*)?$")) for i in insts]
|
|
308
|
+
couplings = design.couplings
|
|
309
|
+
out: dict[str, set[str]] = {}
|
|
310
|
+
|
|
311
|
+
def head(end: str) -> str:
|
|
312
|
+
return end if end in design.routes else end.split(".", 1)[0]
|
|
313
|
+
|
|
314
|
+
for bname, b in model.branches.items():
|
|
315
|
+
if bname in design.routes:
|
|
316
|
+
out[bname] = {bname}
|
|
317
|
+
continue
|
|
318
|
+
c = couplings.get(bname) or (couplings.get(bname.split("_", 1)[1]) if "_" in bname else None)
|
|
319
|
+
if c is not None:
|
|
320
|
+
out[bname] = {head(e) for e in c.between}
|
|
321
|
+
continue
|
|
322
|
+
if bname.startswith("K_") and bname[2:] in design.routes:
|
|
323
|
+
out[bname] = {bname[2:]}
|
|
324
|
+
continue
|
|
325
|
+
hit = next((i for i, pat in pats if pat.match(bname)), None)
|
|
326
|
+
if hit is not None:
|
|
327
|
+
out[bname] = {hit}
|
|
328
|
+
continue
|
|
329
|
+
own = set()
|
|
330
|
+
for n in b.nodes:
|
|
331
|
+
if n == model.ground:
|
|
332
|
+
continue
|
|
333
|
+
n = n.split(":", 1)[1] if n.startswith("route:") else n
|
|
334
|
+
own.add(n.split(".", 1)[0])
|
|
335
|
+
out[bname] = own
|
|
336
|
+
return out
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def _route_nets(model: CircuitModel, design) -> dict[str, list[str]]:
|
|
340
|
+
"""node → the route names whose conductor it is (a C-matrix net labelled with a route name: an edge port where the
|
|
341
|
+
box cuts the line, or a route probe on a line the job keeps whole)."""
|
|
342
|
+
port_node: dict[str, str] = {}
|
|
343
|
+
for name, spec in model.nodes.items():
|
|
344
|
+
for net in spec.nets:
|
|
345
|
+
port_node.setdefault(net, name)
|
|
346
|
+
out: dict[str, list[str]] = {}
|
|
347
|
+
for rname, r in design.routes.items():
|
|
348
|
+
if rname in model.branches: # a resonator: its TLres sits on its coupler-end node
|
|
349
|
+
out.setdefault(model.branches[rname].nodes[0], []).append(rname)
|
|
350
|
+
continue
|
|
351
|
+
node = next((port_node[e] for e in (r.from_, r.to) if isinstance(e, str) and e in port_node), None)
|
|
352
|
+
if node is None and f"route:{rname}" in model.nodes:
|
|
353
|
+
node = f"route:{rname}"
|
|
354
|
+
if node is not None:
|
|
355
|
+
out.setdefault(node, []).append(rname)
|
|
356
|
+
return out
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
def _sim_routes(design, group: str | None, analysis: str | None) -> set[str] | None:
|
|
360
|
+
"""Routes present (uncut) in a job's simulated geometry, or None when unknown."""
|
|
361
|
+
if not group:
|
|
362
|
+
return None
|
|
363
|
+
try:
|
|
364
|
+
from quantcore_circuits.sim_tools.builder import simulation_design # pylint: disable=import-outside-toplevel
|
|
365
|
+
|
|
366
|
+
sim, _ = simulation_design(design, group, analysis or "q3d_cmatrix")
|
|
367
|
+
except Exception: # noqa: BLE001 (an old job whose group is gone: no line-net rule from the routes)
|
|
368
|
+
return None
|
|
369
|
+
return set(sim.routes)
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def _fill_one(model, design_source, job_or_results, synthesis, stack_correction, scope, plan=None) -> FilledCircuit:
|
|
373
|
+
from quantcore_circuits.assembly.last_good import plan_for_lom # pylint: disable=import-outside-toplevel
|
|
374
|
+
from quantcore_circuits.design import load_design # pylint: disable=import-outside-toplevel
|
|
375
|
+
from quantcore_circuits.pdk import get_pdk # pylint: disable=import-outside-toplevel
|
|
376
|
+
|
|
377
|
+
design = load_design(design_source)
|
|
378
|
+
pdk = get_pdk(design.pdk)
|
|
379
|
+
if plan is None: # the caller's plan of this design (loop.analyse plans once), else plan it here
|
|
380
|
+
plan = plan_for_lom(design, design_source) # a failed route: its last good one, with a warning
|
|
381
|
+
notes: list[str] = list(plan.warnings)
|
|
382
|
+
results, job = load_results(job_or_results) if job_or_results is not None else ({}, None)
|
|
383
|
+
group = (job or {}).get("group") or results.get("group")
|
|
384
|
+
if scope == "auto":
|
|
385
|
+
from quantcore_circuits.sim_tools.subset import subset_scope # pylint: disable=import-outside-toplevel
|
|
386
|
+
|
|
387
|
+
if job and "select" in job: # the job records its selection (None: the whole chip)
|
|
388
|
+
scope = job["select"]
|
|
389
|
+
else:
|
|
390
|
+
scope = subset_scope(design, group) if group else None
|
|
391
|
+
scope_set = set(scope) if scope is not None else None
|
|
392
|
+
owners = branch_owners(model, design) if scope_set is not None else {}
|
|
393
|
+
feedlines: set[str] = set()
|
|
394
|
+
if scope_set is not None:
|
|
395
|
+
from quantcore_circuits.sim_tools.subset import _Graph # pylint: disable=import-outside-toplevel
|
|
396
|
+
|
|
397
|
+
feedlines = _Graph(design).feedlines
|
|
398
|
+
|
|
399
|
+
def in_scope(bname: str) -> bool:
|
|
400
|
+
if scope_set is None:
|
|
401
|
+
return True
|
|
402
|
+
own = owners.get(bname) or set()
|
|
403
|
+
return bool(own & scope_set) and own <= scope_set | feedlines
|
|
404
|
+
|
|
405
|
+
cm = results.get("cmatrix")
|
|
406
|
+
labels = cm["labels"] if cm else []
|
|
407
|
+
matrix = np.asarray(cm["matrix"], dtype=float) if cm else np.zeros((0, 0))
|
|
408
|
+
eps_job = _job_permittivity(job)
|
|
409
|
+
eps_design = pdk.stack.substrate_permittivity
|
|
410
|
+
if cm and stack_correction == "auto" and eps_job and abs(eps_job - eps_design) > 1e-6:
|
|
411
|
+
scale = stack_capacitance_scale(eps_job, eps_design)
|
|
412
|
+
matrix = matrix * scale
|
|
413
|
+
notes.append(
|
|
414
|
+
f"stack correction: job simulated with εr={eps_job:g}, design PDK εr={eps_design:g}; capacitances × "
|
|
415
|
+
f"{scale:.4f} ((ε+1)/2 scaling) until the job is re-run on {design.pdk}"
|
|
416
|
+
)
|
|
417
|
+
route_nets = _route_nets(model, design) if cm else {}
|
|
418
|
+
merged_into: dict[str, str] = {}
|
|
419
|
+
if cm:
|
|
420
|
+
labels, matrix, merged_into = _merge_node_nets(model, labels, matrix, route_nets)
|
|
421
|
+
if merged_into:
|
|
422
|
+
notes.append("C-matrix nets of one circuit node merged (a line ties them together): "
|
|
423
|
+
+ ", ".join(f"{a} → {b}" for a, b in merged_into.items()))
|
|
424
|
+
branch_c = branch_capacitances(matrix, labels) if cm else {}
|
|
425
|
+
if cm and job:
|
|
426
|
+
stub = float(job.get("waveguide_length_um", 100.0))
|
|
427
|
+
for port in job.get("ports", []):
|
|
428
|
+
net = port.get("excitation")
|
|
429
|
+
net = merged_into.get(net, net)
|
|
430
|
+
if port.get("kind") == "waveguide" and (net, "ground") in branch_c and stub > 0:
|
|
431
|
+
from quantcore_circuits.analysis.synthesis import cpw_properties # pylint: disable=C0415
|
|
432
|
+
|
|
433
|
+
props = cpw_properties(7.0, pdk.cpw_a, pdk.cpw_b, design.pdk)
|
|
434
|
+
c_stub = stub * 1e-6 / (props["vp_m_s"] * props["Z0_ohm"]) / 1e-15
|
|
435
|
+
branch_c[(net, "ground")] -= c_stub
|
|
436
|
+
notes.append(f"{net}: removed {c_stub:.2f} fF of the {stub:g} µm port stub (counted in the λ/4 line)")
|
|
437
|
+
|
|
438
|
+
def fem_net(node: str) -> str | None:
|
|
439
|
+
if node == model.ground:
|
|
440
|
+
return "ground"
|
|
441
|
+
spec = model.nodes.get(node)
|
|
442
|
+
nets = (list(spec.nets) if spec else []) + route_nets.get(node, [])
|
|
443
|
+
return next((n for n in nets if n in labels), None)
|
|
444
|
+
|
|
445
|
+
# line nets: a net carrying a distributed line has the line's own capacitance in its row sum (module docstring)
|
|
446
|
+
line_nodes: dict[str, list[str]] = {}
|
|
447
|
+
if cm:
|
|
448
|
+
present = (set(job["routes_in_sim"]) if job and "routes_in_sim" in job
|
|
449
|
+
else _sim_routes(design, group, (job or {}).get("analysis")))
|
|
450
|
+
if present is not None and scope_set is not None:
|
|
451
|
+
# a subset box: a route counts when it is selected and kept whole; one that crosses the box is a net
|
|
452
|
+
# labelled with its name (above); other routes left in the geometry lie outside the box
|
|
453
|
+
present &= scope_set
|
|
454
|
+
for node, routes in route_nets.items():
|
|
455
|
+
if fem_net(node) is None:
|
|
456
|
+
continue
|
|
457
|
+
lines = [r for r in routes if r in labels or (present is not None and r in present)]
|
|
458
|
+
if lines:
|
|
459
|
+
line_nodes[node] = lines
|
|
460
|
+
|
|
461
|
+
# missing nets: a chosen component with some nodes in the C-matrix and others not (surface-17's StarQubit: its
|
|
462
|
+
# coupler / readout pins got no excitation, so the FEM treats them as ground) — the ground C of its present nodes
|
|
463
|
+
# then includes the capacitance to the missing ones: keep their estimates
|
|
464
|
+
partial: dict[str, list[str]] = {}
|
|
465
|
+
if cm and scope_set is not None:
|
|
466
|
+
for inst in sorted(scope_set & set(design.instances)):
|
|
467
|
+
own = [n for n in model.nodes if n != model.ground and not model.nodes[n].ground
|
|
468
|
+
and (n == inst or n.startswith(f"{inst}."))]
|
|
469
|
+
missing = [n for n in own if fem_net(n) is None]
|
|
470
|
+
if missing and len(missing) < len(own):
|
|
471
|
+
for n in own:
|
|
472
|
+
if n not in missing:
|
|
473
|
+
partial[n] = missing
|
|
474
|
+
notes.append(f"{inst}: nodes {missing} have no C-matrix net (their conductors are ground in this FEM "
|
|
475
|
+
"job: no port / excitation reached them); the ground capacitances of its other nodes keep "
|
|
476
|
+
"their estimates")
|
|
477
|
+
|
|
478
|
+
syn = _synthesis(model, design, pdk) if synthesis is None else synthesis
|
|
479
|
+
sim = (job or {}).get("simulation_name", "")
|
|
480
|
+
values: dict[str, BranchValue] = {}
|
|
481
|
+
shared: dict[tuple[str, str], list[str]] = {} # FEM net pair → in-scope C branches on it
|
|
482
|
+
for bname, b in model.branches.items():
|
|
483
|
+
a, c = b.nodes
|
|
484
|
+
v = b.value
|
|
485
|
+
if b.type == "C":
|
|
486
|
+
na, nc = fem_net(a), fem_net(c)
|
|
487
|
+
ext = None
|
|
488
|
+
if na and nc and in_scope(bname):
|
|
489
|
+
ext = branch_c.get((na, nc), branch_c.get((nc, na)))
|
|
490
|
+
if ext is not None and "ground" in (na, nc) and any(n in partial for n in (a, c)):
|
|
491
|
+
ext = None
|
|
492
|
+
if ext is not None and "ground" in (na, nc):
|
|
493
|
+
line = next((n for n in (a, c) if n in line_nodes), None)
|
|
494
|
+
if line is not None:
|
|
495
|
+
notes.append(f"{bname}: {fem_net(line)} is a line net ({', '.join(line_nodes[line])} in the "
|
|
496
|
+
f"box): its ground C {ext:.4g} fF includes the line's own capacitance, which the LOM "
|
|
497
|
+
"models as a transmission line; estimate kept")
|
|
498
|
+
ext = None
|
|
499
|
+
if ext is not None and ext <= 0:
|
|
500
|
+
# a Maxwell row that is not diagonally dominant (an unconverged mesh: tutorial 02's pocket pads at
|
|
501
|
+
# Q3D 2 %, island → ground −35 fF) would make the circuit unsolvable: keep the estimate for it
|
|
502
|
+
notes.append(f"{bname}: FEM gave {ext:.3g} fF ({na}–{nc}), not physical (mesh not converged?); "
|
|
503
|
+
"estimate kept")
|
|
504
|
+
ext = None
|
|
505
|
+
if ext is not None:
|
|
506
|
+
shared.setdefault(tuple(sorted((na, nc))), []).append(bname)
|
|
507
|
+
q = a.split(".", 1)[0]
|
|
508
|
+
s = syn.get(q, {}) if a == q else {} # design values for grounded islands (node named after the qubit)
|
|
509
|
+
des = None
|
|
510
|
+
if bname == f"C_{q}" and s:
|
|
511
|
+
cj = (
|
|
512
|
+
next(
|
|
513
|
+
(
|
|
514
|
+
x.value.get("Cj_fF", 0)
|
|
515
|
+
for x in model.branches.values()
|
|
516
|
+
if x.type in ("JJ", "SQUID") and x.nodes[0] == a
|
|
517
|
+
),
|
|
518
|
+
0,
|
|
519
|
+
)
|
|
520
|
+
or 0
|
|
521
|
+
)
|
|
522
|
+
des = s["C_sigma_fF"] - s["Cg_fF"] - cj # island → ground part of C_Σ
|
|
523
|
+
elif bname.startswith(f"Cg_{q}_") and s:
|
|
524
|
+
des = s["Cg_fF"]
|
|
525
|
+
values[bname] = BranchValue(
|
|
526
|
+
"C",
|
|
527
|
+
(a, c),
|
|
528
|
+
"fF",
|
|
529
|
+
ext,
|
|
530
|
+
des,
|
|
531
|
+
f"cmatrix:{sim}" if ext is not None else v.get("estimate_source", "estimate"),
|
|
532
|
+
{},
|
|
533
|
+
v.get("estimate", v.get("C_fF")),
|
|
534
|
+
)
|
|
535
|
+
elif b.type in ("JJ", "SQUID"):
|
|
536
|
+
s = syn.get(a, {})
|
|
537
|
+
lj, extra = junction_branch(b.type, v)
|
|
538
|
+
values[bname] = BranchValue(b.type, (a, c), "nH", None, s.get("Lj_nH"), "design", extra, lj)
|
|
539
|
+
elif b.type == "TLres":
|
|
540
|
+
rp = plan.routes.get(bname)
|
|
541
|
+
length = (rp.length if rp else None) or v.get("length_um")
|
|
542
|
+
if rp and rp.length and v.get("extra_length_um"): # wires / lines / tapers the builder put in the line
|
|
543
|
+
length = rp.length + v["extra_length_um"]
|
|
544
|
+
a_um = rp.params.get("a", pdk.cpw_a) if rp else v.get("a_um", pdk.cpw_a)
|
|
545
|
+
b_um = rp.params.get("b", pdk.cpw_b) if rp else v.get("b_um", pdk.cpw_b)
|
|
546
|
+
tl = _tl_kind(tl_resonator(length, a_um, b_um, design.pdk), v.get("kind", "lambda/4"))
|
|
547
|
+
q = a.split(".", 1)[0]
|
|
548
|
+
values[bname] = BranchValue(
|
|
549
|
+
"TL", (a, c), "µm", None, syn.get(q, {}).get("resonator_length_um"), "layout", tl, length
|
|
550
|
+
)
|
|
551
|
+
elif b.type == "HANGER":
|
|
552
|
+
values[bname] = BranchValue(
|
|
553
|
+
"HANGER", (a, c), "MHz", None, None, v.get("estimate_source", "estimate"), dict(v), v.get("kappa_MHz")
|
|
554
|
+
)
|
|
555
|
+
elif b.type == "R":
|
|
556
|
+
values[bname] = BranchValue(
|
|
557
|
+
"R", (a, c), "Ω", None, v.get("R_ohm", 50.0), "design", {}, v.get("R_ohm", 50.0)
|
|
558
|
+
)
|
|
559
|
+
elif b.type == "L":
|
|
560
|
+
values[bname] = BranchValue("L", (a, c), "nH", None, v.get("L_nH"), "design", {}, v.get("L_nH"))
|
|
561
|
+
|
|
562
|
+
# one FEM value, several branches on the same net pair: share it in proportion to the estimates
|
|
563
|
+
for pair_nets, names in shared.items():
|
|
564
|
+
if len(names) < 2:
|
|
565
|
+
continue
|
|
566
|
+
total = values[names[0]].extracted
|
|
567
|
+
est = [max(values[n].estimate or 0.0, 0.0) for n in names]
|
|
568
|
+
weights = [e / sum(est) for e in est] if sum(est) > 0 else [1 / len(names)] * len(names)
|
|
569
|
+
for n, w in zip(names, weights):
|
|
570
|
+
values[n].extracted = total * w
|
|
571
|
+
values[n].extra = {**values[n].extra, "shared_with": [x for x in names if x != n], "fem_total": total}
|
|
572
|
+
notes.append(f"{'–'.join(pair_nets)}: FEM {total:.4g} fF shared by {', '.join(names)} in proportion to their "
|
|
573
|
+
"estimates")
|
|
574
|
+
|
|
575
|
+
# FEM κ (sim agent, additive): a driven S21 notch fit or the eigenmode Q fills the hanger branches' extracted value
|
|
576
|
+
hangers = {n[2:]: n for n, v in values.items() if v.type == "HANGER" and n.startswith("K_") and n[2:] in values}
|
|
577
|
+
hangers = {r: h for r, h in hangers.items() if in_scope(h)}
|
|
578
|
+
if hangers and (results.get("sparams") or results.get("eigenmodes")):
|
|
579
|
+
from quantcore_circuits.analysis.results import fem_kappa # pylint: disable=import-outside-toplevel
|
|
580
|
+
|
|
581
|
+
guess = {r: values[r].extra.get("f_GHz", 7.0) for r in hangers}
|
|
582
|
+
for r, k in fem_kappa(results, guess).items():
|
|
583
|
+
hv = values[hangers[r]]
|
|
584
|
+
hv.extracted, hv.source = k["kappa_MHz"], k["source"]
|
|
585
|
+
hv.extra = {**hv.extra, "fem": k}
|
|
586
|
+
notes.append(f"{r}: κ_ext {k['kappa_MHz']:.4g} MHz from {k['source']} (LOM estimate {hv.estimate:.4g})")
|
|
587
|
+
|
|
588
|
+
pairs = _pairs(model, values, notes)
|
|
589
|
+
if cm:
|
|
590
|
+
known = set(model.islands()) | {r for rs in route_nets.values() for r in rs}
|
|
591
|
+
unmapped = [lab for lab in labels if lab not in known]
|
|
592
|
+
if unmapped:
|
|
593
|
+
notes.append(f"C-matrix nets not in the circuit (ignored): {unmapped}")
|
|
594
|
+
missing = [n for n, v in values.items() if v.type == "C" and v.extracted is None and in_scope(n)]
|
|
595
|
+
if missing:
|
|
596
|
+
notes.append(f"no FEM value (estimate used): {missing}")
|
|
597
|
+
if scope_set is not None:
|
|
598
|
+
outside = sorted(n for n, v in values.items() if v.type in ("C", "HANGER") and not in_scope(n))
|
|
599
|
+
notes.append(f"subset {group}: fills the branches of {sorted(scope_set)}; {len(outside)} branches outside it "
|
|
600
|
+
"keep their estimates")
|
|
601
|
+
cmat = {"labels": labels, "matrix": matrix.tolist()} if cm else None
|
|
602
|
+
jobs = []
|
|
603
|
+
if job_or_results is not None:
|
|
604
|
+
jobs.append({
|
|
605
|
+
"job": (job or {}).get("simulation_name") or group,
|
|
606
|
+
"group": group,
|
|
607
|
+
"analysis": (job or {}).get("analysis"),
|
|
608
|
+
"scope": sorted(scope_set) if scope_set is not None else None,
|
|
609
|
+
"in_scope": sorted(n for n in values if in_scope(n)) if scope_set is not None else None,
|
|
610
|
+
"filled": sorted(n for n, v in values.items() if v.extracted is not None),
|
|
611
|
+
"results": results,
|
|
612
|
+
})
|
|
613
|
+
return FilledCircuit(model, design, values, cmat, pairs, (job or {}).get("simulation_name"), notes, results, jobs)
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
def _fill_standalone(model: CircuitModel) -> FilledCircuit:
|
|
617
|
+
values: dict[str, BranchValue] = {}
|
|
618
|
+
for bname, b in model.branches.items():
|
|
619
|
+
v, (a, c) = b.value, b.nodes
|
|
620
|
+
if b.type == "C":
|
|
621
|
+
val = v.get("C_fF", v.get("value", v.get("estimate")))
|
|
622
|
+
values[bname] = BranchValue(
|
|
623
|
+
"C", (a, c), "fF", None, None, v.get("estimate_source", "circuit.json"), {}, val
|
|
624
|
+
)
|
|
625
|
+
elif b.type in ("JJ", "SQUID"):
|
|
626
|
+
lj, extra = junction_branch(b.type, v)
|
|
627
|
+
values[bname] = BranchValue(b.type, (a, c), "nH", None, None, "circuit.json", extra, lj)
|
|
628
|
+
elif b.type == "TLres":
|
|
629
|
+
if "f_GHz" not in v or "Z0_ohm" not in v:
|
|
630
|
+
tl = _tl_kind(
|
|
631
|
+
tl_resonator(v["length_um"], v.get("a_um", 10.0), v.get("b_um", 6.0)), v.get("kind", "lambda/4")
|
|
632
|
+
)
|
|
633
|
+
else: # stored f is already the mode's (λ/2 doubled by the builder)
|
|
634
|
+
keys = ("f_GHz", "Z0_ohm", "vp_m_s", "L_geo_nH_per_m", "L_k_nH_per_m", "alpha_k")
|
|
635
|
+
tl = {k: v[k] for k in keys if k in v}
|
|
636
|
+
tl["kind"] = v.get("kind", "lambda/4")
|
|
637
|
+
values[bname] = BranchValue("TL", (a, c), "µm", None, None, "circuit.json", tl, v.get("length_um"))
|
|
638
|
+
elif b.type == "HANGER":
|
|
639
|
+
values[bname] = BranchValue(
|
|
640
|
+
"HANGER", (a, c), "MHz", None, None, "circuit.json", dict(v), v.get("kappa_MHz")
|
|
641
|
+
)
|
|
642
|
+
elif b.type == "R":
|
|
643
|
+
values[bname] = BranchValue("R", (a, c), "Ω", None, None, "circuit.json", {}, v.get("R_ohm", 50.0))
|
|
644
|
+
elif b.type == "L":
|
|
645
|
+
values[bname] = BranchValue("L", (a, c), "nH", None, None, "circuit.json", {}, v.get("L_nH"))
|
|
646
|
+
notes: list[str] = []
|
|
647
|
+
return FilledCircuit(model, None, values, None, _pairs(model, values, notes), None, notes)
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
def _tl_kind(tl: dict, kind: str) -> dict:
|
|
651
|
+
"""Resonator values for its mode: ``tl_resonator`` gives the λ/4 fundamental; a λ/2 line of the same length
|
|
652
|
+
resonates at twice that (and has the λ/2 equivalent LC)."""
|
|
653
|
+
tl = dict(tl, kind=kind)
|
|
654
|
+
if kind == "lambda/2":
|
|
655
|
+
tl["f_GHz"] = tl["f_GHz"] * 2
|
|
656
|
+
tl.pop("C_fF", None)
|
|
657
|
+
tl.pop("L_nH", None)
|
|
658
|
+
return tl
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
def _c_between(model: CircuitModel, values: dict[str, BranchValue], a: str, b: str) -> float:
|
|
662
|
+
"""Sum of the chosen values of all C branches between nodes a and b (0 if none or unknown)."""
|
|
663
|
+
tot = 0.0
|
|
664
|
+
for n, x in model.branches.items():
|
|
665
|
+
if x.type == "C" and set(x.nodes) == {a, b} and values[n].value is not None:
|
|
666
|
+
tot += values[n].value
|
|
667
|
+
return tot
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
def _c_total(model: CircuitModel, values: dict[str, BranchValue], a: str) -> float:
|
|
671
|
+
"""All capacitance on node ``a`` (to ground and to every other node): its Maxwell diagonal with the rest of the
|
|
672
|
+
circuit held at ground (the usual LOM reduction; Metal does the same)."""
|
|
673
|
+
tot = 0.0
|
|
674
|
+
for n, x in model.branches.items():
|
|
675
|
+
if x.type == "C" and a in x.nodes and values[n].value is not None:
|
|
676
|
+
tot += values[n].value
|
|
677
|
+
return tot
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
def _floating_maxwell(model, values, n1: str, n2: str, cnode: str) -> tuple[np.ndarray, bool]:
|
|
681
|
+
"""Effective 2-node Maxwell matrix (qubit mode, coupler) of a floating transmon (islands n1, n2).
|
|
682
|
+
|
|
683
|
+
The 3-node network (n1, n2, coupler) has a common mode φ_s = (φ1 + φ2)/2 with no potential energy, so its charge
|
|
684
|
+
is conserved (zero); the qubit mode is φ_d = φ1 − φ2. With φ = T ψ, ψ = (φ_d, φ_s, φ_c), the Hamiltonian's inverse
|
|
685
|
+
capacitance for (φ_d, φ_c) is the (d, c) block of (Tᵀ C T)⁻¹; its inverse is the equivalent grounded 2-node
|
|
686
|
+
Maxwell matrix that the transmon–resonator adapters use. The result does not depend on how φ_s is defined.
|
|
687
|
+
Returns (matrix, flipped): the sign of φ_d is chosen so the island–coupler mutual capacitance is positive.
|
|
688
|
+
"""
|
|
689
|
+
idx = [n1, n2, cnode]
|
|
690
|
+
m = np.zeros((3, 3))
|
|
691
|
+
for i, a in enumerate(idx):
|
|
692
|
+
m[i, i] = _c_total(model, values, a) # nodes outside the pair are held at ground
|
|
693
|
+
for j, b in enumerate(idx):
|
|
694
|
+
if i != j:
|
|
695
|
+
m[i, j] = -_c_between(model, values, a, b)
|
|
696
|
+
t = np.array([[0.5, 1.0, 0.0], [-0.5, 1.0, 0.0], [0.0, 0.0, 1.0]])
|
|
697
|
+
inv = np.linalg.inv(t.T @ m @ t)
|
|
698
|
+
eff = np.linalg.inv(inv[np.ix_([0, 2], [0, 2])])
|
|
699
|
+
flipped = eff[0, 1] > 0
|
|
700
|
+
if flipped:
|
|
701
|
+
eff[0, 1] = eff[1, 0] = -eff[0, 1]
|
|
702
|
+
return eff, flipped
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
def _pairs(model: CircuitModel, values: dict[str, BranchValue], notes: list[str]) -> list[TransmonReadout]:
|
|
706
|
+
"""Transmon + readout pairs: a λ/4 or λ/2 ``TLres`` on a coupler node that one JJ/SQUID island reaches through a C.
|
|
707
|
+
|
|
708
|
+
Grounded transmons (JJ island → ground) and floating ones (JJ between two islands, reduced to the equivalent
|
|
709
|
+
grounded 2-node model, :func:`_floating_maxwell`). Every other conductor is held at ground (its capacitance to
|
|
710
|
+
the pair's nodes loads them). A resonator that several qubits reach (a coupling bus) is not a readout pair.
|
|
711
|
+
"""
|
|
712
|
+
pairs = []
|
|
713
|
+
gnd = model.ground
|
|
714
|
+
junctions = {n: j for n, j in model.branches.items() if j.type in ("JJ", "SQUID")}
|
|
715
|
+
for rname, b in model.branches.items():
|
|
716
|
+
kind = values[rname].extra.get("kind", "lambda/4")
|
|
717
|
+
if b.type != "TLres" or kind not in ("lambda/4", "lambda/2"):
|
|
718
|
+
continue
|
|
719
|
+
cnode = b.nodes[0]
|
|
720
|
+
reach = [
|
|
721
|
+
jn for jn, j in junctions.items() if any(_c_between(model, values, n, cnode) for n in j.nodes if n != gnd)
|
|
722
|
+
]
|
|
723
|
+
if len(reach) > 1:
|
|
724
|
+
notes.append(f"{rname}: reached by {len(reach)} qubits ({', '.join(reach)}): a bus, not a readout pair")
|
|
725
|
+
continue
|
|
726
|
+
for jname in reach:
|
|
727
|
+
j = junctions[jname]
|
|
728
|
+
if values[jname].value is None:
|
|
729
|
+
notes.append(f"{jname}/{rname}: missing junction value, pair skipped")
|
|
730
|
+
continue
|
|
731
|
+
floating = gnd not in j.nodes
|
|
732
|
+
if floating:
|
|
733
|
+
n1, n2 = j.nodes
|
|
734
|
+
maxwell, flipped = _floating_maxwell(model, values, n1, n2, cnode)
|
|
735
|
+
q = jname[2:] if jname.startswith("J_") else n1
|
|
736
|
+
isl_q = model.nodes[n2 if flipped else n1].island or q
|
|
737
|
+
else:
|
|
738
|
+
q = j.nodes[0] if j.nodes[1] == gnd else j.nodes[1]
|
|
739
|
+
c_g = _c_between(model, values, q, cnode)
|
|
740
|
+
if not _c_between(model, values, q, gnd):
|
|
741
|
+
continue
|
|
742
|
+
maxwell = np.array(
|
|
743
|
+
[[_c_total(model, values, q), -c_g], [-c_g, _c_total(model, values, cnode)]], dtype=float
|
|
744
|
+
)
|
|
745
|
+
isl_q = model.nodes[q].island or q
|
|
746
|
+
tl = values[rname].extra
|
|
747
|
+
hanger = next((h for h, x in model.branches.items() if x.type == "HANGER" and cnode in x.nodes), None)
|
|
748
|
+
isl_c = model.nodes[cnode].island or cnode
|
|
749
|
+
pairs.append(
|
|
750
|
+
TransmonReadout(
|
|
751
|
+
qubit=q,
|
|
752
|
+
resonator=rname,
|
|
753
|
+
labels=[isl_q, isl_c],
|
|
754
|
+
cmatrix_fF=maxwell,
|
|
755
|
+
lj_nH=values[jname].value,
|
|
756
|
+
lj0_nH=values[jname].extra.get("Lj0_nH"),
|
|
757
|
+
cj_fF=values[jname].extra.get("Cj_fF", 0.0) or 0.0,
|
|
758
|
+
f_r_GHz=tl["f_GHz"],
|
|
759
|
+
z0_ohm=tl["Z0_ohm"],
|
|
760
|
+
feedline=next((n for n in model.branches[hanger].nodes if n != cnode), None) if hanger else None,
|
|
761
|
+
squid=values[jname].type == "SQUID",
|
|
762
|
+
asym=values[jname].extra.get("asym", 0.0),
|
|
763
|
+
flux_phi0=values[jname].extra.get("flux_phi0", 0.0),
|
|
764
|
+
kappa_MHz=values[hanger].value if hanger else None,
|
|
765
|
+
kind=kind,
|
|
766
|
+
)
|
|
767
|
+
)
|
|
768
|
+
if floating:
|
|
769
|
+
notes.append(f"{q}/{rname}: floating transmon reduced to its equivalent grounded 2-node model")
|
|
770
|
+
if kind == "lambda/2":
|
|
771
|
+
notes.append(f"{q}/{rname}: λ/2 readout (its fundamental as a parallel LC, C_r = π/(2 ω Z0))")
|
|
772
|
+
return pairs
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
def junction_branch(kind: str, v: dict) -> tuple[float | None, dict]:
|
|
776
|
+
"""(L nH, extra) of a ``JJ`` / ``SQUID`` branch value: a SQUID's L at its ``flux_phi0`` and ``asym``
|
|
777
|
+
(:func:`~quantcore_circuits.lom.fragment.squid_l_eff`; ``Lj_nH`` is L_J0 and is kept as ``extra["Lj0_nH"]`` when
|
|
778
|
+
the flux changes it). The estimators, QuCat and the pairs use this L."""
|
|
779
|
+
lj = v.get("Lj_nH")
|
|
780
|
+
extra = {"Cj_fF": v.get("Cj_fF", 0), **{k: v[k] for k in ("asym", "flux_phi0") if k in v}}
|
|
781
|
+
if kind == "SQUID" and lj and (v.get("flux_phi0") or 0.0):
|
|
782
|
+
from quantcore_circuits.lom.fragment import squid_l_eff # pylint: disable=import-outside-toplevel
|
|
783
|
+
|
|
784
|
+
extra["Lj0_nH"] = lj
|
|
785
|
+
lj = squid_l_eff(lj, v.get("flux_phi0") or 0.0, v.get("asym") or 0.0)
|
|
786
|
+
return lj, extra
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
def resonator_lc(f_GHz: float, z0_ohm: float, kind: str = "lambda/4") -> tuple[float, float]:
|
|
790
|
+
"""(C fF, L nH) of the parallel LC equivalent of a TL resonator's fundamental at its open end:
|
|
791
|
+
C = π/(4 ω Z0) for λ/4, π/(2 ω Z0) for λ/2, L = 1/(ω² C)."""
|
|
792
|
+
if kind != "lambda/2":
|
|
793
|
+
return quarter_wave_lc(f_GHz, z0_ohm)
|
|
794
|
+
w = 2 * np.pi * f_GHz * 1e9
|
|
795
|
+
cr = np.pi / (2 * w * z0_ohm)
|
|
796
|
+
return float(cr / 1e-15), float(1 / (w**2 * cr) / 1e-9)
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
def two_node_model(p: TransmonReadout) -> dict:
|
|
800
|
+
"""Analytic loaded transmon–resonator model from the 2-node capacitance network + λ/4 LC.
|
|
801
|
+
|
|
802
|
+
Island (1) and coupler/resonator node (2): C = [[C1 + Cg, −Cg], [−Cg, C2 + Cg]] with C1 = island→ground (+Cj),
|
|
803
|
+
C2 = coupler→ground + C_r. Then EC = e²(C⁻¹)₁₁/2h, f_r = 1/(2π√(L_r/(C⁻¹)₂₂)), and the exchange coupling
|
|
804
|
+
g = 2e(C⁻¹)₁₂ Q_zpf ⟨1|n|0⟩/h with Q_zpf = √(ħω_r/(2(C⁻¹)₂₂)).
|
|
805
|
+
"""
|
|
806
|
+
from quantcore_circuits.analysis.transmon import ej_from_lj, n01_matrix_element # pylint: disable=C0415
|
|
807
|
+
|
|
808
|
+
e, hbar, h = 1.602176634e-19, 1.054571817e-34, 6.62607015e-34
|
|
809
|
+
cr_fF, lr_nH = resonator_lc(p.f_r_GHz, p.z0_ohm, p.kind)
|
|
810
|
+
c1, cg, c2 = p.c_island_fF, p.cg_fF, p.c_coupler_fF + cr_fF
|
|
811
|
+
cmat = np.array([[c1 + cg, -cg], [-cg, c2 + cg]]) * 1e-15
|
|
812
|
+
inv = np.linalg.inv(cmat)
|
|
813
|
+
ec = e**2 * inv[0, 0] / 2 / h / 1e9
|
|
814
|
+
ej = ej_from_lj(p.lj_nH)
|
|
815
|
+
w_r = 1 / np.sqrt(lr_nH * 1e-9 / inv[1, 1])
|
|
816
|
+
q_zpf = np.sqrt(hbar * w_r / (2 * inv[1, 1]))
|
|
817
|
+
g_n = 2 * e * inv[0, 1] * q_zpf / h / 1e6 # MHz, charge (n̂) coupling
|
|
818
|
+
n01 = n01_matrix_element(ej, ec)
|
|
819
|
+
return {
|
|
820
|
+
"EJ_GHz": float(ej),
|
|
821
|
+
"EC_GHz": float(ec),
|
|
822
|
+
"C_sigma_fF": float(1 / inv[0, 0] / 1e-15),
|
|
823
|
+
"f_r_loaded_GHz": float(w_r / 2 / np.pi / 1e9),
|
|
824
|
+
"g_MHz": float(abs(g_n) * n01),
|
|
825
|
+
"g_n_MHz": float(abs(g_n)),
|
|
826
|
+
"C_r_fF": cr_fF,
|
|
827
|
+
"L_r_nH": lr_nH,
|
|
828
|
+
}
|