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,549 @@
|
|
|
1
|
+
"""Solver outputs → one result schema (``job/results/results.json``).
|
|
2
|
+
|
|
3
|
+
Schema (all optional except ``analysis``)::
|
|
4
|
+
|
|
5
|
+
{"analysis": "q3d_cmatrix", "design_hash": ..., "group": ...,
|
|
6
|
+
"cmatrix": {"labels": [...], "unit": "fF", "matrix": [[...]]}, # Maxwell matrix, signal nets only
|
|
7
|
+
"eigenmodes": [{"f_GHz": 5.1, "Q": 1e6}, ...],
|
|
8
|
+
"epr": {...}, "raw_files": [...]}
|
|
9
|
+
|
|
10
|
+
Parsers read KQC's job outputs (``<sim>_project_results.json``, ``<sim>_project_modes.eig``, pyEPR ``QData_*.csv``)
|
|
11
|
+
and Palace's ``postpro`` CSVs.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import csv
|
|
17
|
+
import json
|
|
18
|
+
import re
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
|
|
21
|
+
import numpy as np
|
|
22
|
+
|
|
23
|
+
_NUM = r"[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def net_labels(job: dict, n: int, rows: list[str] | None = None) -> list[str]:
|
|
27
|
+
"""Labels for C-matrix rows (KQC excitations 1..n, or the AEDT signal nets ``rows`` such as ``["Net1", "Net2"]``
|
|
28
|
+
in matrix order, as recorded by ``qcc_solve.py``; AEDT net ``Net<k>`` is KQC excitation k).
|
|
29
|
+
|
|
30
|
+
Jobs record ``nets`` (excitation → label, probed from KQC's conductor partition at export); older jobs fall back
|
|
31
|
+
to excitation k ↔ port k. Unlabelled conductors are ``floating_<k>``.
|
|
32
|
+
"""
|
|
33
|
+
order = list(range(1, n + 1))
|
|
34
|
+
if rows:
|
|
35
|
+
nums = [re.fullmatch(r"Net(\d+)", r) for r in rows]
|
|
36
|
+
if all(nums):
|
|
37
|
+
order = [int(m.group(1)) for m in nums]
|
|
38
|
+
if job.get("nets"):
|
|
39
|
+
nets = {int(k): v for k, v in job["nets"].items()}
|
|
40
|
+
return [nets.get(k, f"floating_{k}") for k in order]
|
|
41
|
+
by_number = {p["number"]: p.get("excitation") or p["name"] for p in job.get("ports", [])}
|
|
42
|
+
return [by_number.get(k, f"floating_{k}") for k in range(1, n + 1)]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def to_maxwell(c) -> tuple[np.ndarray, str]:
|
|
46
|
+
"""Return the Maxwell form of a capacitance matrix (positive diagonal, non-positive off-diagonal).
|
|
47
|
+
|
|
48
|
+
AEDT Q3D results exported by KQC's scripts carry the mutual capacitances as *positive* off-diagonal entries
|
|
49
|
+
(diagonal = total capacitance of the net, as in the Maxwell matrix); Palace and Elmer write the Maxwell matrix.
|
|
50
|
+
Both are accepted; the returned tag says which convention was found ("maxwell" or "mutual").
|
|
51
|
+
"""
|
|
52
|
+
c = np.asarray(c, dtype=float)
|
|
53
|
+
off = c - np.diag(np.diag(c))
|
|
54
|
+
tol = 1e-9 * (float(np.abs(c).max()) or 1.0)
|
|
55
|
+
if (off >= -tol).all() and (off > tol).any():
|
|
56
|
+
return np.diag(np.diag(c)) - off, "mutual"
|
|
57
|
+
return c, "maxwell"
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def parse_cmatrix_json(path: Path) -> np.ndarray:
|
|
61
|
+
data = json.loads(path.read_text(encoding="utf-8"))
|
|
62
|
+
mat = data.get("CMatrix") or data.get("Cs")
|
|
63
|
+
if mat is None:
|
|
64
|
+
raise ValueError(f"{path}: no CMatrix")
|
|
65
|
+
return np.asarray(mat, dtype=float)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def parse_eig(path: Path) -> list[dict]:
|
|
69
|
+
"""HFSS ``ExportEigenmodes`` text. Tolerant: accepts ``idx f [Q]`` rows (GHz or Hz), ``(re, im)`` pairs and AEDT
|
|
70
|
+
2024's ``idx f_re + f_im j Q`` rows (``Q`` = f_re / 2 f_im when the column is missing)."""
|
|
71
|
+
modes = []
|
|
72
|
+
for line in path.read_text(encoding="utf-8", errors="replace").splitlines():
|
|
73
|
+
cplx = re.search(rf"\(\s*({_NUM})\s*,\s*({_NUM})\s*\)", line)
|
|
74
|
+
aedt = re.match(rf"^\s*(\d+)\s+({_NUM})\s*([-+])\s*({_NUM})\s*j\s*({_NUM})?\s*$", line)
|
|
75
|
+
nums = [float(x) for x in re.findall(_NUM, line)]
|
|
76
|
+
if not nums or not line.strip()[0].isdigit():
|
|
77
|
+
continue
|
|
78
|
+
if aedt:
|
|
79
|
+
re_f = float(aedt.group(2))
|
|
80
|
+
im_f = float(aedt.group(4)) * (-1 if aedt.group(3) == "-" else 1)
|
|
81
|
+
f = re_f / 1e9 if re_f > 1e6 else re_f
|
|
82
|
+
q = float(aedt.group(5)) if aedt.group(5) else (re_f / (2 * im_f) if im_f else float("inf"))
|
|
83
|
+
modes.append({"mode": int(aedt.group(1)), "f_GHz": f, "Q": q})
|
|
84
|
+
continue
|
|
85
|
+
if cplx:
|
|
86
|
+
re_f, im_f = float(cplx.group(1)), float(cplx.group(2))
|
|
87
|
+
f = re_f / 1e9 if re_f > 1e6 else re_f
|
|
88
|
+
q = re_f / (2 * im_f) if im_f else float("inf")
|
|
89
|
+
elif len(nums) >= 2:
|
|
90
|
+
f = nums[1] / 1e9 if nums[1] > 1e6 else nums[1]
|
|
91
|
+
q = nums[2] if len(nums) > 2 else None
|
|
92
|
+
else:
|
|
93
|
+
continue
|
|
94
|
+
modes.append({"mode": int(nums[0]), "f_GHz": f, "Q": q})
|
|
95
|
+
return modes
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def parse_palace_terminal_c(path: Path) -> np.ndarray:
|
|
99
|
+
"""Palace ``terminal-C.csv``: first column terminal index, then C[i][j] in F."""
|
|
100
|
+
with open(path, newline="", encoding="utf-8") as f:
|
|
101
|
+
rows = [r for r in csv.reader(f) if r and not r[0].strip().startswith("#")]
|
|
102
|
+
body = [r for r in rows if re.fullmatch(_NUM, r[0].strip())]
|
|
103
|
+
return np.asarray([[float(x) for x in r[1:]] for r in body], dtype=float)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def parse_palace_eig(path: Path) -> list[dict]:
|
|
107
|
+
"""Palace ``eig.csv``: m, Re{f} (GHz), Im{f} (GHz), Q, ..."""
|
|
108
|
+
with open(path, newline="", encoding="utf-8") as f:
|
|
109
|
+
rows = [r for r in csv.reader(f) if r]
|
|
110
|
+
out = []
|
|
111
|
+
for r in rows:
|
|
112
|
+
if not re.fullmatch(_NUM, r[0].strip()):
|
|
113
|
+
continue
|
|
114
|
+
vals = [float(x) for x in r]
|
|
115
|
+
out.append({"mode": int(vals[0]), "f_GHz": vals[1], "Q": vals[3] if len(vals) > 3 else None})
|
|
116
|
+
return out
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def parse_touchstone(path: Path) -> tuple[np.ndarray, np.ndarray, float]:
|
|
120
|
+
"""Touchstone v1 ``.sNp`` (as KQC's ``export_solution_data.py`` writes ``<sim>_SMatrix.sNp``).
|
|
121
|
+
|
|
122
|
+
Returns ``(f_GHz, S, z0)`` with ``S[k, i, j]`` complex (S_ij at frequency k, ports 1-based in the file, 0-based
|
|
123
|
+
here). Handles the ``# <unit> S <MA|DB|RI> R <z0>`` option line and values wrapped over several lines.
|
|
124
|
+
"""
|
|
125
|
+
n = int(re.search(r"\.s(\d+)p$", path.name.lower()).group(1))
|
|
126
|
+
unit, fmt, z0 = "GHZ", "MA", 50.0
|
|
127
|
+
nums: list[float] = []
|
|
128
|
+
for raw in path.read_text(encoding="utf-8", errors="replace").splitlines():
|
|
129
|
+
line = raw.split("!", 1)[0].strip()
|
|
130
|
+
if not line:
|
|
131
|
+
continue
|
|
132
|
+
if line.startswith("#"):
|
|
133
|
+
tok = line[1:].upper().split()
|
|
134
|
+
unit = next((t for t in tok if t in ("HZ", "KHZ", "MHZ", "GHZ")), unit)
|
|
135
|
+
fmt = next((t for t in tok if t in ("MA", "DB", "RI")), fmt)
|
|
136
|
+
if "R" in tok and tok.index("R") + 1 < len(tok):
|
|
137
|
+
z0 = float(tok[tok.index("R") + 1])
|
|
138
|
+
continue
|
|
139
|
+
nums.extend(float(x) for x in line.split())
|
|
140
|
+
per = 1 + 2 * n * n
|
|
141
|
+
data = np.asarray(nums[: len(nums) // per * per]).reshape(-1, per)
|
|
142
|
+
scale = {"HZ": 1e-9, "KHZ": 1e-6, "MHZ": 1e-3, "GHZ": 1.0}[unit]
|
|
143
|
+
f = data[:, 0] * scale
|
|
144
|
+
a, b = data[:, 1::2], data[:, 2::2]
|
|
145
|
+
if fmt == "RI":
|
|
146
|
+
vals = a + 1j * b
|
|
147
|
+
elif fmt == "DB":
|
|
148
|
+
vals = 10 ** (a / 20) * np.exp(1j * np.radians(b))
|
|
149
|
+
else:
|
|
150
|
+
vals = a * np.exp(1j * np.radians(b))
|
|
151
|
+
S = vals.reshape(-1, n, n)
|
|
152
|
+
if n == 2: # Touchstone 2-port order is S11 S21 S12 S22 (column-major)
|
|
153
|
+
S = S.transpose(0, 2, 1)
|
|
154
|
+
return f, S, z0
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def fit_notch(f_GHz, s21, min_depth: float = 1e-3, window: float = 25.0) -> dict:
|
|
158
|
+
"""Fit a notch (hanger) resonance to complex S21 (Khalil/Probst model, real-coupling approximation).
|
|
159
|
+
|
|
160
|
+
S21 = A e^{iα} [1 − (Q_l/Q_c) e^{iφ} / (1 + 2i Q_l (f/f0 − 1))]. Returns f0, Q_l, Q_c, Q_i and the linewidths
|
|
161
|
+
κ = f0/Q_l, κ_ext = f0/Q_c (MHz) — κ_ext is what the LOM hanger coupling (``HANGER`` k) predicts. A cable delay
|
|
162
|
+
is not removed: export S-parameters de-embedded to the ports (KQC does by default). Raises ``ValueError`` when
|
|
163
|
+
the |S21| dip is shallower than ``min_depth`` (no resonance in the band); fits ±``window`` linewidths around the
|
|
164
|
+
dip when the band is wider.
|
|
165
|
+
"""
|
|
166
|
+
from scipy.optimize import least_squares # pylint: disable=import-outside-toplevel
|
|
167
|
+
|
|
168
|
+
f = np.asarray(f_GHz, dtype=float)
|
|
169
|
+
s = np.asarray(s21, dtype=complex)
|
|
170
|
+
k0 = int(np.argmin(np.abs(s)))
|
|
171
|
+
depth = 1 - abs(s[k0]) / max(np.abs(s).max(), 1e-12)
|
|
172
|
+
if depth < min_depth:
|
|
173
|
+
raise ValueError(f"no resonance in the trace (|S21| dip {depth:.2e} < {min_depth:g})")
|
|
174
|
+
width = _dip_width(f, s, k0)
|
|
175
|
+
# a band much wider than the line: fit ±window linewidths around the dip (keeps the baseline local)
|
|
176
|
+
keep = np.abs(f - f[k0]) <= window * width
|
|
177
|
+
if keep.sum() >= 50 and keep.sum() < len(f):
|
|
178
|
+
f, s = f[keep], s[keep]
|
|
179
|
+
k0 = int(np.argmin(np.abs(s)))
|
|
180
|
+
f0 = f[k0]
|
|
181
|
+
ql0 = f0 / width
|
|
182
|
+
|
|
183
|
+
def model(x):
|
|
184
|
+
a, alpha, fr, ql, qc, phi = x
|
|
185
|
+
return a * np.exp(1j * alpha) * (1 - (ql / qc) * np.exp(1j * phi) / (1 + 2j * ql * (f / fr - 1)))
|
|
186
|
+
|
|
187
|
+
def residual(x):
|
|
188
|
+
d = model(x) - s
|
|
189
|
+
return np.concatenate([d.real, d.imag])
|
|
190
|
+
|
|
191
|
+
x0 = [np.abs(s).max(), float(np.angle(s[0])), f0, ql0, ql0 / max(depth, 1e-3), 0.0]
|
|
192
|
+
lo = [0, -np.pi * 4, f.min(), 1.0, 1.0, -np.pi / 2]
|
|
193
|
+
hi = [10, np.pi * 4, f.max(), 1e9, 1e10, np.pi / 2]
|
|
194
|
+
sol = least_squares(residual, x0, bounds=(lo, hi), x_scale="jac")
|
|
195
|
+
a, alpha, fr, ql, qc, phi = sol.x
|
|
196
|
+
qc_re = qc / np.cos(phi) # effective real coupling Q
|
|
197
|
+
inv_qi = 1 / ql - 1 / qc_re
|
|
198
|
+
return {
|
|
199
|
+
"f0_GHz": float(fr),
|
|
200
|
+
"Q_loaded": float(ql),
|
|
201
|
+
"Q_coupling": float(qc_re),
|
|
202
|
+
"Q_internal": float(1 / inv_qi) if inv_qi > 0 else float("inf"),
|
|
203
|
+
"kappa_MHz": float(fr / ql * 1e3),
|
|
204
|
+
"kappa_ext_MHz": float(fr / qc_re * 1e3),
|
|
205
|
+
"phi": float(phi),
|
|
206
|
+
"residual_rms": float(np.sqrt(np.mean(np.abs(model(sol.x) - s) ** 2))),
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def _dip_width(f: np.ndarray, s: np.ndarray, k0: int) -> float:
|
|
211
|
+
"""Full width at half depth (in |S21|²) of the dip at ``k0``, walking out from it — the contiguous dip only, so
|
|
212
|
+
a second notch elsewhere in the band does not widen it (fem_loop, 2026-11-04)."""
|
|
213
|
+
a = np.abs(s) ** 2
|
|
214
|
+
level = (a.max() + a[k0]) / 2
|
|
215
|
+
i = j = k0
|
|
216
|
+
while i > 0 and a[i - 1] <= level:
|
|
217
|
+
i -= 1
|
|
218
|
+
while j < len(a) - 1 and a[j + 1] <= level:
|
|
219
|
+
j += 1
|
|
220
|
+
step = f[1] - f[0] if len(f) > 1 else 1e-6
|
|
221
|
+
return max(f[j] - f[i], step)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def fit_notches(f_GHz, s21, min_depth: float = 1e-2, window: float = 25.0, max_notches: int = 8) -> list[dict]:
|
|
225
|
+
"""Every notch in a trace (several resonators on one feedline), lowest frequency first: dips of prominence
|
|
226
|
+
≥ ``min_depth`` (relative to the baseline), each fitted with :func:`fit_notch` on its own stretch of the band
|
|
227
|
+
(between the midpoints to its neighbours)."""
|
|
228
|
+
from scipy.signal import find_peaks # pylint: disable=import-outside-toplevel
|
|
229
|
+
|
|
230
|
+
f = np.asarray(f_GHz, dtype=float)
|
|
231
|
+
s = np.asarray(s21, dtype=complex)
|
|
232
|
+
mag = np.abs(s)
|
|
233
|
+
dips, _ = find_peaks(-mag, prominence=min_depth * float(np.median(mag)))
|
|
234
|
+
dips = sorted(dips, key=lambda k: mag[k])[:max_notches] # the deepest ones
|
|
235
|
+
dips = sorted(dips)
|
|
236
|
+
out = []
|
|
237
|
+
for n, k in enumerate(dips):
|
|
238
|
+
lo = 0 if n == 0 else (dips[n - 1] + k) // 2
|
|
239
|
+
hi = len(f) if n == len(dips) - 1 else (k + dips[n + 1]) // 2
|
|
240
|
+
try:
|
|
241
|
+
fit = fit_notch(f[lo:hi], s[lo:hi], min_depth=min_depth / 10, window=window)
|
|
242
|
+
except (ValueError, RuntimeError):
|
|
243
|
+
continue
|
|
244
|
+
fit["depth"] = float(1 - mag[k] / max(mag.max(), 1e-12))
|
|
245
|
+
out.append(fit)
|
|
246
|
+
return out
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def parse_convergence(path: Path) -> dict:
|
|
250
|
+
"""AEDT ``ExportConvergence`` text: passes, solved elements, the criterion per pass and whether it converged."""
|
|
251
|
+
text = Path(path).read_text(encoding="utf-8", errors="replace")
|
|
252
|
+
rows = re.findall(rf"^\s*(\d+)\|\s*(\d+)\|\s*({_NUM}|N/A)\|", text, flags=re.M)
|
|
253
|
+
crit = re.search(r"Criterion\s*:\s*(.+)", text)
|
|
254
|
+
target = re.search(rf"Target\s*:\s*({_NUM})", text)
|
|
255
|
+
return {
|
|
256
|
+
"converged": bool(re.search(r"Converged\s*:\s*Yes", text)),
|
|
257
|
+
"criterion": crit.group(1).strip() if crit else None,
|
|
258
|
+
"target": float(target.group(1)) if target else None,
|
|
259
|
+
"passes": [int(r[0]) for r in rows],
|
|
260
|
+
"elements": [int(r[1]) for r in rows],
|
|
261
|
+
"delta": [None if r[2] == "N/A" else float(r[2]) for r in rows],
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
def parse_report_csv(path: Path) -> dict[str, list[float]]:
|
|
266
|
+
"""An AEDT report exported as CSV (e.g. KQC's eigenmode "Solution Convergence": Pass, re(Mode(n)))."""
|
|
267
|
+
with open(path, newline="", encoding="utf-8", errors="replace") as f:
|
|
268
|
+
rows = [r for r in csv.reader(f) if r]
|
|
269
|
+
head, body = rows[0], rows[1:]
|
|
270
|
+
out: dict[str, list[float]] = {}
|
|
271
|
+
for i, name in enumerate(head):
|
|
272
|
+
unit = re.search(r"\[([A-Za-z]*)\]\s*$", name)
|
|
273
|
+
scale = {"hz": 1e-9, "khz": 1e-6, "mhz": 1e-3, "ghz": 1.0}.get(unit.group(1).lower(), 1.0) if unit else 1.0
|
|
274
|
+
key = re.sub(r"\s*\[[^\]]*\]\s*$", "", name).strip().strip('"')
|
|
275
|
+
vals = []
|
|
276
|
+
for r in body:
|
|
277
|
+
try:
|
|
278
|
+
vals.append(float(r[i]) * scale)
|
|
279
|
+
except (ValueError, IndexError):
|
|
280
|
+
vals.append(float("nan"))
|
|
281
|
+
out[key] = vals
|
|
282
|
+
return out
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def extrapolate_mesh(elements, values, last: int = 5) -> dict | None:
|
|
286
|
+
"""f(N) = f∞ − C N^(−p) fitted to the last ``last`` adaptive passes (N = solved elements): the mesh-converged
|
|
287
|
+
estimate of a quantity whose adaptive run stopped before its criterion. None if the fit is not meaningful."""
|
|
288
|
+
from scipy.optimize import curve_fit # pylint: disable=import-outside-toplevel
|
|
289
|
+
|
|
290
|
+
n = np.asarray(elements[-last:], dtype=float)
|
|
291
|
+
f = np.asarray(values[-last:], dtype=float)
|
|
292
|
+
if len(n) < 4 or not np.all(np.isfinite(f)):
|
|
293
|
+
return None
|
|
294
|
+
try:
|
|
295
|
+
x = n / n[-1]
|
|
296
|
+
(finf, c, p), _ = curve_fit(
|
|
297
|
+
lambda x, a, b, q: a - b * x ** (-q), x, f, p0=(f[-1], f[-1] - f[0], 1.0), maxfev=20000
|
|
298
|
+
)
|
|
299
|
+
except (RuntimeError, ValueError):
|
|
300
|
+
return None
|
|
301
|
+
if not (0.05 < p < 5) or not np.isfinite(finf):
|
|
302
|
+
return None
|
|
303
|
+
return {
|
|
304
|
+
"value": float(finf),
|
|
305
|
+
"last": float(f[-1]),
|
|
306
|
+
"change": float(finf - f[-1]),
|
|
307
|
+
"p": float(p),
|
|
308
|
+
"passes_used": len(n),
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def fem_kappa(results: dict, resonators: dict[str, float], max_residual: float = 0.05) -> dict[str, dict]:
|
|
313
|
+
"""External linewidth κ_ext/2π per resonator from a solved job.
|
|
314
|
+
|
|
315
|
+
Driven jobs: the S_ij notch fit whose f0 is closest to the resonator's expected frequency (``resonators``: name →
|
|
316
|
+
GHz, e.g. its λ/4 estimate). Eigenmode jobs (feedline terminated in 50 Ω): f/Q_ext of the nearest mode that is
|
|
317
|
+
not a qubit mode (junction participation < 0.5), with the bulk-dielectric loss removed when the EPR substrate
|
|
318
|
+
participation is known. Returns name → ``{"kappa_MHz", "f_GHz", "Q_ext", "source"}``.
|
|
319
|
+
"""
|
|
320
|
+
out: dict[str, dict] = {}
|
|
321
|
+
sp = results.get("sparams") or {}
|
|
322
|
+
fits = [
|
|
323
|
+
(k, v)
|
|
324
|
+
for k, v in (sp.get("notch") or {}).items()
|
|
325
|
+
if v.get("residual_rms", 1.0) < max_residual and np.isfinite(v.get("kappa_ext_MHz", np.nan))
|
|
326
|
+
]
|
|
327
|
+
for r, f_guess in sorted(resonators.items(), key=lambda x: x[1]):
|
|
328
|
+
if not fits:
|
|
329
|
+
break
|
|
330
|
+
k, v = min(fits, key=lambda kv: abs(kv[1]["f0_GHz"] - f_guess))
|
|
331
|
+
fits.remove((k, v))
|
|
332
|
+
out[r] = {
|
|
333
|
+
"kappa_MHz": v["kappa_ext_MHz"],
|
|
334
|
+
"f_GHz": v["f0_GHz"],
|
|
335
|
+
"Q_ext": v["Q_coupling"],
|
|
336
|
+
"source": f"driven {k} notch fit ({sp.get('file')})",
|
|
337
|
+
}
|
|
338
|
+
if out:
|
|
339
|
+
return out
|
|
340
|
+
eig = results.get("eigenmodes") or []
|
|
341
|
+
epr = results.get("epr") or {}
|
|
342
|
+
p, q_d = epr.get("p_mj"), epr.get("Q_dielectric")
|
|
343
|
+
free = [i for i in range(len(eig)) if not p or i >= len(p) or max(p[i]) < 0.5]
|
|
344
|
+
for r, f_guess in sorted(resonators.items(), key=lambda x: x[1]):
|
|
345
|
+
if not free:
|
|
346
|
+
break
|
|
347
|
+
i = min(free, key=lambda i: abs(eig[i]["f_GHz"] - f_guess))
|
|
348
|
+
free.remove(i)
|
|
349
|
+
q = eig[i].get("Q")
|
|
350
|
+
if not q or not np.isfinite(q):
|
|
351
|
+
continue
|
|
352
|
+
qd = q_d[i] if q_d and i < len(q_d) else None
|
|
353
|
+
q_ext = 1 / (1 / q - 1 / qd) if qd and 1 / q > 1 / qd else q
|
|
354
|
+
out[r] = {
|
|
355
|
+
"kappa_MHz": eig[i]["f_GHz"] / q_ext * 1e3,
|
|
356
|
+
"f_GHz": eig[i]["f_GHz"],
|
|
357
|
+
"Q_ext": q_ext,
|
|
358
|
+
"source": f"eigenmode {eig[i].get('mode', i + 1)} Q (50 Ω-terminated feedline)",
|
|
359
|
+
}
|
|
360
|
+
return out
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
def combine_jobs(primary: str | Path, others: list[str | Path], out_dir: str | Path, same_design: bool = True) -> Path:
|
|
364
|
+
"""A job directory that ``loop.analyse`` / ``circuit.fill`` read as one: the ``primary`` job's ``job.json``
|
|
365
|
+
(C-matrix metadata: ports, stub length, stack) with its results, plus the ``eigenmodes`` / ``epr`` / ``sparams``
|
|
366
|
+
of the ``others``. E.g. Q3D C-matrix → LOM estimators and eigenmode EPR → pyEPR in one consensus.
|
|
367
|
+
``results.json`` records where each part came from (``combined_from``). The others must come from the same design
|
|
368
|
+
(hash) unless ``same_design=False`` (e.g. a copy that only adds a sim group); mismatches are then listed."""
|
|
369
|
+
primary, out = Path(primary), Path(out_dir)
|
|
370
|
+
job = json.loads((primary / "job.json").read_text(encoding="utf-8"))
|
|
371
|
+
res = json.loads((primary / "results" / "results.json").read_text(encoding="utf-8"))
|
|
372
|
+
sources = {k: str(primary) for k in ("cmatrix", "eigenmodes", "epr", "sparams") if k in res}
|
|
373
|
+
mismatch = []
|
|
374
|
+
for other in map(Path, others):
|
|
375
|
+
ojob = json.loads((other / "job.json").read_text(encoding="utf-8"))
|
|
376
|
+
if ojob["design_hash"] != job["design_hash"]:
|
|
377
|
+
if same_design:
|
|
378
|
+
raise ValueError(f"{other}: design hash {ojob['design_hash']} differs from {job['design_hash']}")
|
|
379
|
+
mismatch.append(f"{other.name}: design hash {ojob['design_hash']} (primary {job['design_hash']})")
|
|
380
|
+
ores = json.loads((other / "results" / "results.json").read_text(encoding="utf-8"))
|
|
381
|
+
for key in ("eigenmodes", "epr", "sparams"):
|
|
382
|
+
if key in ores:
|
|
383
|
+
res[key] = ores[key]
|
|
384
|
+
sources[key] = str(other)
|
|
385
|
+
res["combined_from"] = sources
|
|
386
|
+
if mismatch:
|
|
387
|
+
res["combined_hash_mismatch"] = mismatch
|
|
388
|
+
(out / "results").mkdir(parents=True, exist_ok=True)
|
|
389
|
+
job = {**job, "status": "done", "combined_from": sorted(set(sources.values()))}
|
|
390
|
+
(out / "job.json").write_text(json.dumps(job, indent=2) + "\n", encoding="utf-8")
|
|
391
|
+
(out / "results" / "results.json").write_text(json.dumps(res, indent=2) + "\n", encoding="utf-8")
|
|
392
|
+
return out
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
def read_extras(job_dir: str | Path) -> dict:
|
|
396
|
+
"""``<sim>_project_qcc.json`` written by ``qcc_solve.py`` inside AEDT ({} if absent); ``_file`` = its name."""
|
|
397
|
+
hits = sorted(Path(job_dir).glob("*_project_qcc.json"))
|
|
398
|
+
if not hits:
|
|
399
|
+
return {}
|
|
400
|
+
data = json.loads(hits[0].read_text(encoding="utf-8"))
|
|
401
|
+
data["_file"] = hits[0].name
|
|
402
|
+
return data
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
def signal_nets(extras: dict) -> list[str]:
|
|
406
|
+
"""Q3D signal nets in ``GetExcitations`` order (KQC's ``export_solution_data.py`` C-matrix row order)."""
|
|
407
|
+
exc = extras.get("excitations") or []
|
|
408
|
+
return [name for name, kind in zip(exc[::2], exc[1::2]) if kind == "SignalNet"]
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
def smatrix_ports(job: dict, extras: dict, n: int) -> list[int]:
|
|
412
|
+
"""Port numbers of the S-matrix columns: AEDT's excitation order (``"2"``, ``"3"`` …) when recorded, else the
|
|
413
|
+
job's non-junction ports (``qcc_solve.py`` turns driven junction ports into lumped L/C)."""
|
|
414
|
+
exc = extras.get("excitations") or []
|
|
415
|
+
nums = []
|
|
416
|
+
for name in exc:
|
|
417
|
+
m = re.fullmatch(r"(?:Port)?(\d+)(?:_T\d+)?", str(name))
|
|
418
|
+
if m and int(m.group(1)) not in nums:
|
|
419
|
+
nums.append(int(m.group(1)))
|
|
420
|
+
if len(nums) == n:
|
|
421
|
+
return nums
|
|
422
|
+
ports = sorted(job.get("ports", []), key=lambda p: p["number"])
|
|
423
|
+
real = [p["number"] for p in ports if p.get("kind") != "junction"]
|
|
424
|
+
return real if len(real) == n else [p["number"] for p in ports][:n]
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
def _junction_names(job: dict, numbers: list[str]) -> list[str]:
|
|
428
|
+
by_number = {str(p["number"]): p.get("name") for p in job.get("ports", [])}
|
|
429
|
+
return [by_number.get(str(n), f"junction_{n}") for n in numbers]
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
def collect_results(job_dir: str | Path) -> dict:
|
|
433
|
+
"""Parse whatever results exist in ``job_dir`` and write ``results/results.json``."""
|
|
434
|
+
job_dir = Path(job_dir)
|
|
435
|
+
job = json.loads((job_dir / "job.json").read_text(encoding="utf-8"))
|
|
436
|
+
out = {"analysis": job["analysis"], "design_hash": job["design_hash"], "group": job["group"], "raw_files": []}
|
|
437
|
+
|
|
438
|
+
extras = read_extras(job_dir)
|
|
439
|
+
if extras:
|
|
440
|
+
out["aedt"] = {k: extras.get(k) for k in ("aedt", "python", "tool", "solve_seconds", "convergence_file")}
|
|
441
|
+
out["raw_files"].append(extras["_file"])
|
|
442
|
+
cmats = sorted(job_dir.glob("*_project_results.json"))
|
|
443
|
+
for path in cmats:
|
|
444
|
+
try:
|
|
445
|
+
c = parse_cmatrix_json(path)
|
|
446
|
+
except ValueError:
|
|
447
|
+
continue
|
|
448
|
+
c, convention = to_maxwell(c)
|
|
449
|
+
rows = signal_nets(extras)
|
|
450
|
+
out["cmatrix"] = {
|
|
451
|
+
"labels": net_labels(job, len(c), rows if len(rows) == len(c) else None),
|
|
452
|
+
"unit": "fF",
|
|
453
|
+
"matrix": (c * 1e15).tolist(),
|
|
454
|
+
"form": "maxwell",
|
|
455
|
+
"source_convention": convention,
|
|
456
|
+
}
|
|
457
|
+
if len(rows) == len(c):
|
|
458
|
+
out["cmatrix"]["aedt_nets"] = rows
|
|
459
|
+
out["raw_files"].append(path.name)
|
|
460
|
+
for path in sorted(job_dir.glob("*_project_modes.eig")):
|
|
461
|
+
out["eigenmodes"] = parse_eig(path)
|
|
462
|
+
out["raw_files"].append(path.name)
|
|
463
|
+
for path in sorted(job_dir.glob("*_project_convergence.txt")):
|
|
464
|
+
out["convergence"] = {"file": path.name, **parse_convergence(path)}
|
|
465
|
+
out["raw_files"].append(path.name)
|
|
466
|
+
for _name, fname in sorted((extras.get("convergence_reports") or {}).items()):
|
|
467
|
+
path = job_dir / fname
|
|
468
|
+
if not path.exists() or "eigenmodes" not in out:
|
|
469
|
+
continue
|
|
470
|
+
table = parse_report_csv(path)
|
|
471
|
+
conv = out.setdefault("convergence", {"passes": []})
|
|
472
|
+
cols = {k: v for k, v in table.items() if re.search(r"Mode\((\d+)\)", k)}
|
|
473
|
+
# AEDT 2024 writes the header unit as "[]" with the values in Hz
|
|
474
|
+
cols = {k: [x / 1e9 for x in v] if np.nanmedian(v) > 1e6 else v for k, v in cols.items()}
|
|
475
|
+
conv["mode_GHz"] = {re.search(r"Mode\((\d+)\)", k).group(1): v for k, v in cols.items()}
|
|
476
|
+
conv["report"] = fname
|
|
477
|
+
elements = conv.get("elements") or []
|
|
478
|
+
for mode in out["eigenmodes"]:
|
|
479
|
+
series = conv["mode_GHz"].get(str(mode["mode"]))
|
|
480
|
+
if series and len(series) == len(elements):
|
|
481
|
+
mode["f_extrapolated"] = extrapolate_mesh(elements, series)
|
|
482
|
+
out["raw_files"].append(fname)
|
|
483
|
+
for path in sorted(job_dir.glob("QData_*.csv")): # KQC's run_pyepr_t1_estimate.py output (not run by qcc)
|
|
484
|
+
import pandas as pd # pylint: disable=import-outside-toplevel
|
|
485
|
+
|
|
486
|
+
out["epr_kqc"] = pd.read_csv(path).to_dict(orient="list")
|
|
487
|
+
out["raw_files"].append(path.name)
|
|
488
|
+
if extras.get("epr", {}).get("modes"):
|
|
489
|
+
from quantcore_circuits.analysis.epr import epr_analysis # pylint: disable=import-outside-toplevel
|
|
490
|
+
|
|
491
|
+
eig = out.get("eigenmodes") or []
|
|
492
|
+
n = len(extras["epr"]["modes"])
|
|
493
|
+
freqs = [m["f_GHz"] for m in eig[:n]] if len(eig) >= n else None
|
|
494
|
+
tan_d = (job.get("settings", {}).get("pyepr") or {}).get("substrate_loss_tangent")
|
|
495
|
+
try:
|
|
496
|
+
out["epr"] = epr_analysis(
|
|
497
|
+
extras["epr"], freqs, Q=[m.get("Q") for m in eig[:n]] if freqs else None, tan_delta=tan_d
|
|
498
|
+
)
|
|
499
|
+
out["epr"]["junction_names"] = _junction_names(job, out["epr"]["junctions"])
|
|
500
|
+
except Exception as e: # noqa: BLE001 (keep the other results if the EPR step cannot evaluate)
|
|
501
|
+
out["epr"] = {"error": f"{type(e).__name__}: {e}"}
|
|
502
|
+
palace_c = next(iter(job_dir.glob("**/terminal-C.csv")), None)
|
|
503
|
+
if palace_c is not None:
|
|
504
|
+
c, convention = to_maxwell(parse_palace_terminal_c(palace_c))
|
|
505
|
+
out["cmatrix"] = {
|
|
506
|
+
"labels": net_labels(job, len(c)),
|
|
507
|
+
"unit": "fF",
|
|
508
|
+
"matrix": (c * 1e15).tolist(),
|
|
509
|
+
"form": "maxwell",
|
|
510
|
+
"source_convention": convention,
|
|
511
|
+
}
|
|
512
|
+
out["raw_files"].append(str(palace_c.relative_to(job_dir)))
|
|
513
|
+
for path in sorted(job_dir.glob("*_SMatrix*.s*p")): # HFSS driven (hfss_driven): S-parameters → notch fits
|
|
514
|
+
f, S, z0 = parse_touchstone(path)
|
|
515
|
+
numbers = smatrix_ports(job, extras, S.shape[1])
|
|
516
|
+
by_number = {p["number"]: p.get("name") for p in job.get("ports", [])}
|
|
517
|
+
labels = [by_number.get(n, str(n)) for n in numbers]
|
|
518
|
+
out["sparams"] = {
|
|
519
|
+
"file": path.name,
|
|
520
|
+
"ports": labels,
|
|
521
|
+
"port_numbers": numbers,
|
|
522
|
+
"z0_ohm": z0,
|
|
523
|
+
"f_GHz": [float(f.min()), float(f.max())],
|
|
524
|
+
"n_points": len(f),
|
|
525
|
+
}
|
|
526
|
+
if S.shape[1] >= 2:
|
|
527
|
+
# one fit per notch: "S21" is the deepest (the single-resonator case as before), further notches of
|
|
528
|
+
# the same trace (several resonators on one feedline) are "S21#2", "S21#3", … (deepest first)
|
|
529
|
+
fits = {}
|
|
530
|
+
for i in range(S.shape[1]):
|
|
531
|
+
for j in range(i):
|
|
532
|
+
found = sorted(fit_notches(f, S[:, i, j]), key=lambda v: -v["depth"])
|
|
533
|
+
if not found:
|
|
534
|
+
try:
|
|
535
|
+
found = [fit_notch(f, S[:, i, j])]
|
|
536
|
+
except (ValueError, RuntimeError):
|
|
537
|
+
continue
|
|
538
|
+
for n, fit in enumerate(found):
|
|
539
|
+
fits[f"S{i + 1}{j + 1}" + (f"#{n + 1}" if n else "")] = fit
|
|
540
|
+
out["sparams"]["notch"] = fits
|
|
541
|
+
out["raw_files"].append(path.name)
|
|
542
|
+
palace_eig = next(iter(job_dir.glob("**/eig.csv")), None)
|
|
543
|
+
if palace_eig is not None:
|
|
544
|
+
out["eigenmodes"] = parse_palace_eig(palace_eig)
|
|
545
|
+
out["raw_files"].append(str(palace_eig.relative_to(job_dir)))
|
|
546
|
+
|
|
547
|
+
(job_dir / "results").mkdir(exist_ok=True)
|
|
548
|
+
(job_dir / "results" / "results.json").write_text(json.dumps(out, indent=2) + "\n", encoding="utf-8")
|
|
549
|
+
return out
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""Results store: SQLite table keyed by (design hash, sim group, analysis); each row holds the result JSON."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import sqlite3
|
|
8
|
+
from datetime import UTC, datetime
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
DEFAULT_STORE = Path(os.environ.get("QCC_RESULTS_STORE", "results.sqlite"))
|
|
12
|
+
|
|
13
|
+
_SCHEMA = """
|
|
14
|
+
CREATE TABLE IF NOT EXISTS results (
|
|
15
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
16
|
+
design_hash TEXT NOT NULL,
|
|
17
|
+
design TEXT,
|
|
18
|
+
grp TEXT NOT NULL,
|
|
19
|
+
analysis TEXT NOT NULL,
|
|
20
|
+
kind TEXT NOT NULL, -- 'sim' (parsed solver output) or 'params' (extracted Hamiltonian params)
|
|
21
|
+
created TEXT NOT NULL,
|
|
22
|
+
job_dir TEXT,
|
|
23
|
+
data TEXT NOT NULL
|
|
24
|
+
);
|
|
25
|
+
CREATE INDEX IF NOT EXISTS ix_key ON results (design_hash, grp, analysis, kind);
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class ResultsStore:
|
|
30
|
+
def __init__(self, path: str | Path = DEFAULT_STORE):
|
|
31
|
+
self.path = Path(path)
|
|
32
|
+
self.path.parent.mkdir(parents=True, exist_ok=True)
|
|
33
|
+
with self._connect() as con:
|
|
34
|
+
con.executescript(_SCHEMA)
|
|
35
|
+
|
|
36
|
+
def _connect(self):
|
|
37
|
+
return sqlite3.connect(self.path)
|
|
38
|
+
|
|
39
|
+
def put(self, design_hash, group, analysis, data: dict, kind="params", design=None, job_dir=None) -> int:
|
|
40
|
+
with self._connect() as con:
|
|
41
|
+
cur = con.execute(
|
|
42
|
+
"INSERT INTO results (design_hash, design, grp, analysis, kind, created, job_dir, data) "
|
|
43
|
+
"VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
|
|
44
|
+
(
|
|
45
|
+
design_hash,
|
|
46
|
+
design,
|
|
47
|
+
group,
|
|
48
|
+
analysis,
|
|
49
|
+
kind,
|
|
50
|
+
datetime.now(UTC).isoformat(timespec="seconds"),
|
|
51
|
+
None if job_dir is None else str(job_dir),
|
|
52
|
+
json.dumps(data, default=float),
|
|
53
|
+
),
|
|
54
|
+
)
|
|
55
|
+
return int(cur.lastrowid)
|
|
56
|
+
|
|
57
|
+
def latest(self, design_hash, group=None, analysis=None, kind="params") -> dict | None:
|
|
58
|
+
rows = self.query(design_hash=design_hash, group=group, analysis=analysis, kind=kind, limit=1)
|
|
59
|
+
return rows[0] if rows else None
|
|
60
|
+
|
|
61
|
+
def query(self, design_hash=None, group=None, analysis=None, kind=None, design=None, limit=100) -> list[dict]:
|
|
62
|
+
sql, args = "SELECT id, design_hash, design, grp, analysis, kind, created, job_dir, data FROM results", []
|
|
63
|
+
cond = []
|
|
64
|
+
for col, val in (
|
|
65
|
+
("design_hash", design_hash),
|
|
66
|
+
("grp", group),
|
|
67
|
+
("analysis", analysis),
|
|
68
|
+
("kind", kind),
|
|
69
|
+
("design", design),
|
|
70
|
+
):
|
|
71
|
+
if val is not None:
|
|
72
|
+
cond.append(f"{col} = ?")
|
|
73
|
+
args.append(val)
|
|
74
|
+
if cond:
|
|
75
|
+
sql += " WHERE " + " AND ".join(cond)
|
|
76
|
+
sql += " ORDER BY id DESC LIMIT ?"
|
|
77
|
+
args.append(limit)
|
|
78
|
+
with self._connect() as con:
|
|
79
|
+
rows = con.execute(sql, args).fetchall()
|
|
80
|
+
keys = ("id", "design_hash", "design", "group", "analysis", "kind", "created", "job_dir", "data")
|
|
81
|
+
return [{**dict(zip(keys, r)), "data": json.loads(r[-1])} for r in rows]
|