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,583 @@
|
|
|
1
|
+
"""Render a design into an Ansys HFSS / Q3D project (geometry, materials, ports, Lj boundaries), and solve it.
|
|
2
|
+
|
|
3
|
+
``render`` = ``build_simulation`` → KQC ``export_ansys`` job → one batch AEDT run of ``scripts/qcc_render.py``
|
|
4
|
+
(:mod:`.aedt_scripts`: KQC's ``import_simulation_geometry.py`` + qcc port fix-ups + π-model/reports, saved as
|
|
5
|
+
``<sim>_project.aedt``, no solve). ``solve`` runs ``scripts/qcc_solve.py`` on a job directory (import, fix-ups,
|
|
6
|
+
``AnalyzeAll``, KQC's ``export_solution_data.py``, qcc extras incl. the pyEPR field integrals) and then
|
|
7
|
+
:func:`~quantcore_circuits.analysis.results.collect_results`.
|
|
8
|
+
|
|
9
|
+
Where AEDT runs (``aedt=``, :mod:`.aedt_session`): ``"batch"`` (default, or ``QCC_AEDT_MODE``) a *separate*
|
|
10
|
+
non-graphical process (``-ng`` + pyaedt's feature flag); ``"gui"`` a new AEDT window that stays open after the run;
|
|
11
|
+
``"attach"`` inside an AEDT window that is already open (else as ``"gui"``), released afterwards with every project
|
|
12
|
+
left open. While a job runs, one progress line (step, pass, mesh, ΔF / ΔS / ΔC, mode frequencies) is printed every
|
|
13
|
+
``progress`` s (30; :mod:`.aedt_progress`). On a timeout only processes qcc started are killed (never an attached
|
|
14
|
+
session).
|
|
15
|
+
|
|
16
|
+
``group="chip"`` renders the whole chip (nothing cut; bond pads get 50 Ω lumped ports), any other name renders that
|
|
17
|
+
``sim_groups`` cut-out. Verified on AEDT 2024 R1 (v241, Windows).
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
import json
|
|
23
|
+
import os
|
|
24
|
+
import re
|
|
25
|
+
import subprocess
|
|
26
|
+
import time
|
|
27
|
+
from dataclasses import dataclass, field
|
|
28
|
+
from pathlib import Path
|
|
29
|
+
|
|
30
|
+
from quantcore_circuits import track as _track
|
|
31
|
+
from quantcore_circuits.sim_tools.aedt_progress import echo, format_progress, read_progress
|
|
32
|
+
from quantcore_circuits.sim_tools.aedt_project import check_settings, project_info
|
|
33
|
+
from quantcore_circuits.sim_tools.aedt_scripts import (
|
|
34
|
+
AEDT_SOURCE,
|
|
35
|
+
COLLECT_SCRIPT,
|
|
36
|
+
RENDER_SCRIPT,
|
|
37
|
+
SCRIPT_MODE,
|
|
38
|
+
SOLVE_SCRIPT,
|
|
39
|
+
STATUS_FILE,
|
|
40
|
+
write_scripts,
|
|
41
|
+
)
|
|
42
|
+
from quantcore_circuits.sim_tools.aedt_session import (
|
|
43
|
+
AEDT_MODES,
|
|
44
|
+
attach_command,
|
|
45
|
+
find_sessions,
|
|
46
|
+
launch_gui,
|
|
47
|
+
pick_session,
|
|
48
|
+
pid_alive,
|
|
49
|
+
progress_interval,
|
|
50
|
+
resolve_mode,
|
|
51
|
+
)
|
|
52
|
+
from quantcore_circuits.sim_tools.ansys import find_ansys_executable
|
|
53
|
+
from quantcore_circuits.sim_tools.builder import CHIP_GROUP, build_simulation
|
|
54
|
+
from quantcore_circuits.sim_tools.export import export_job, read_job, solver_of, update_job
|
|
55
|
+
|
|
56
|
+
__all__ = [
|
|
57
|
+
"AEDT_MODES",
|
|
58
|
+
"RENDER_SCRIPT",
|
|
59
|
+
"SOLVE_SCRIPT",
|
|
60
|
+
"RenderResult",
|
|
61
|
+
"aedt_env",
|
|
62
|
+
"aedt_summary",
|
|
63
|
+
"check_project",
|
|
64
|
+
"check_settings",
|
|
65
|
+
"project_info",
|
|
66
|
+
"render",
|
|
67
|
+
"render_command",
|
|
68
|
+
"render_status",
|
|
69
|
+
"solve",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
_RENDER_SOURCE = AEDT_SOURCE # kept for callers of the old name
|
|
73
|
+
NG_FEATURE = "SF6694_NON_GRAPHICAL_COMMAND_EXECUTION"
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@dataclass
|
|
77
|
+
class RenderResult:
|
|
78
|
+
job_dir: Path
|
|
79
|
+
project: Path | None
|
|
80
|
+
log: Path
|
|
81
|
+
returncode: int
|
|
82
|
+
seconds: float
|
|
83
|
+
summary: dict = field(default_factory=dict)
|
|
84
|
+
status: list[str] = field(default_factory=list)
|
|
85
|
+
results: dict = field(default_factory=dict) # solve: collect_results output
|
|
86
|
+
pid: int | None = None
|
|
87
|
+
mode: str = "batch" # where AEDT ran: batch | gui | attach (see aedt_session)
|
|
88
|
+
owned: bool = True # the AEDT process was started by qcc (False: an attached session)
|
|
89
|
+
note: str = ""
|
|
90
|
+
|
|
91
|
+
@property
|
|
92
|
+
def ok(self) -> bool:
|
|
93
|
+
return (
|
|
94
|
+
self.project is not None
|
|
95
|
+
and self.project.exists()
|
|
96
|
+
and not any(s == "error" or s.startswith("error ") for s in self.status)
|
|
97
|
+
and "done" in self.status
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def render_command(
|
|
102
|
+
job_dir: Path, executable: Path | None = None, graphical: bool = False, script: str = RENDER_SCRIPT
|
|
103
|
+
) -> list[str]:
|
|
104
|
+
"""``ansysedt`` command line for a qcc AEDT script (non-graphical by default, as pyaedt launches AEDT)."""
|
|
105
|
+
exe = executable or find_ansys_executable()
|
|
106
|
+
if exe is None:
|
|
107
|
+
raise FileNotFoundError(
|
|
108
|
+
"AEDT 2024 (ansysedt, v241+) not found; install Electronics Desktop or set QCC_ANSYS_EXECUTABLE"
|
|
109
|
+
)
|
|
110
|
+
sim_json = f"{read_job(job_dir)['simulation_name']}.json"
|
|
111
|
+
cmd = [str(exe)]
|
|
112
|
+
if not graphical:
|
|
113
|
+
cmd += ["-ng", f"-features={NG_FEATURE}"]
|
|
114
|
+
return cmd + ["-RunScriptAndExit", f"scripts/{script}", "-ScriptArgs", sim_json]
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def aedt_env() -> dict:
|
|
118
|
+
"""Environment for batch AEDT runs (enables non-graphical script execution)."""
|
|
119
|
+
return {**os.environ, f"ANSYSEM_FEATURE_{NG_FEATURE}_ENABLE": "1"}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def render_status(job_dir: str | Path, mode: str = "render") -> list[str]:
|
|
123
|
+
path = Path(job_dir) / STATUS_FILE[mode]
|
|
124
|
+
return path.read_text(encoding="utf-8", errors="replace").splitlines() if path.exists() else []
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def aedt_summary(project: str | Path) -> dict:
|
|
128
|
+
"""Design type and name, solution type, variables, boundaries by type, nets and setups of an ``.aedt`` file."""
|
|
129
|
+
info = project_info(project)
|
|
130
|
+
if not info["designs"]:
|
|
131
|
+
return {"models": 0}
|
|
132
|
+
d = info["designs"][0]
|
|
133
|
+
bounds = d["boundaries"]
|
|
134
|
+
by_type: dict[str, int] = {}
|
|
135
|
+
for b in bounds.values():
|
|
136
|
+
by_type[b.get("BoundType", "?")] = by_type.get(b.get("BoundType", "?"), 0) + 1
|
|
137
|
+
return {
|
|
138
|
+
"design_type": d["design_type"],
|
|
139
|
+
"design": d["name"],
|
|
140
|
+
"solution_type": d["solution_type"],
|
|
141
|
+
"variables": d["variables"],
|
|
142
|
+
"boundaries": sorted(bounds),
|
|
143
|
+
"boundary_types": by_type,
|
|
144
|
+
"lumped_rlc": by_type.get("Lumped RLC", 0),
|
|
145
|
+
"lumped_ports": by_type.get("Lumped Port", 0),
|
|
146
|
+
"wave_ports": by_type.get("Wave Port", 0),
|
|
147
|
+
"nets": {k: v["excitations"] for k, v in d["nets"].items() if v["type"] == "SignalNet"},
|
|
148
|
+
"setups": sorted(d["setups"]),
|
|
149
|
+
"materials": info["materials"],
|
|
150
|
+
"models": len(info["designs"]),
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def check_project(job_dir: str | Path) -> dict:
|
|
155
|
+
"""Read the rendered project back and check it against the job: stack, ports/boundaries, nets, settings.
|
|
156
|
+
|
|
157
|
+
Returns ``{"ok": bool, "checks": [{"check", "ok", "detail"}], "settings": [...]}``.
|
|
158
|
+
"""
|
|
159
|
+
job_dir = Path(job_dir)
|
|
160
|
+
job = read_job(job_dir)
|
|
161
|
+
project = _project_path(job_dir)
|
|
162
|
+
checks: list[dict] = []
|
|
163
|
+
|
|
164
|
+
def add(name, ok, detail=""):
|
|
165
|
+
checks.append({"check": name, "ok": bool(ok), "detail": detail})
|
|
166
|
+
|
|
167
|
+
if project is None:
|
|
168
|
+
add("project saved", False, "no *_project.aedt")
|
|
169
|
+
return {"ok": False, "checks": checks, "settings": []}
|
|
170
|
+
info = project_info(project)
|
|
171
|
+
d = info["designs"][0]
|
|
172
|
+
analysis = job["analysis"]
|
|
173
|
+
want_type = {"q3d_cmatrix": "Q3D Extractor"}.get(analysis, "HFSS")
|
|
174
|
+
add("design type", d["design_type"] == want_type, f"{d['design_type']} / {d['solution_type']}")
|
|
175
|
+
if want_type == "HFSS":
|
|
176
|
+
want_sol = "Eigenmode" if analysis in ("hfss_eigenmode", "eigenmode_epr") else "HFSS Terminal Network"
|
|
177
|
+
add("solution type", d["solution_type"] == want_sol, str(d["solution_type"]))
|
|
178
|
+
from quantcore_circuits.pdk import get_pdk # pylint: disable=import-outside-toplevel
|
|
179
|
+
|
|
180
|
+
pdk_name = job.get("versions", {}).get("pdk", "").split("@", 1)[0]
|
|
181
|
+
stack = get_pdk(pdk_name).stack if pdk_name else None
|
|
182
|
+
subs = [p for p in d["parts"] if str(p["name"]).startswith("substrate")]
|
|
183
|
+
for p in subs:
|
|
184
|
+
mat = info["materials"].get(p["material"], {})
|
|
185
|
+
eps = float(mat.get("permittivity", "nan"))
|
|
186
|
+
thick = float(str(p.get("box", {}).get("ZSize", "nan")).replace("um", ""))
|
|
187
|
+
if stack is not None:
|
|
188
|
+
add(
|
|
189
|
+
f"{p['name']} stack",
|
|
190
|
+
abs(eps - stack.substrate_permittivity) < 1e-9 and abs(thick - stack.substrate_height) < 1e-6,
|
|
191
|
+
f"{p['material']} εr {eps:g}, {thick:g} µm (PDK {stack.substrate_permittivity:g}, "
|
|
192
|
+
f"{stack.substrate_height:g} µm)",
|
|
193
|
+
)
|
|
194
|
+
bounds = d["boundaries"]
|
|
195
|
+
metal = {p["name"] for p in d["parts"] if str(p["name"]).startswith(("1t1_signal", "1t1_ground", "2b1_"))}
|
|
196
|
+
sheet_type = "ThinConductor" if want_type == "Q3D Extractor" else "Perfect E"
|
|
197
|
+
covered = {o for b in bounds.values() if b.get("BoundType") == sheet_type for o in b["objects"]}
|
|
198
|
+
add(f"metal sheets {sheet_type}", metal and metal <= covered, f"{len(metal & covered)}/{len(metal)} sheets")
|
|
199
|
+
rlc = {k: v for k, v in bounds.items() if v.get("BoundType") == "Lumped RLC"}
|
|
200
|
+
sim_json = job_dir / f"{job['simulation_name']}.json"
|
|
201
|
+
sim_ports = (
|
|
202
|
+
{p["number"]: p for p in json.loads(sim_json.read_text(encoding="utf-8")).get("ports", [])}
|
|
203
|
+
if sim_json.exists()
|
|
204
|
+
else {}
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
def same(var, want): # "1.2e-08H" / "2e-15farad" vs the exported port value (H, F)
|
|
208
|
+
got = re.match(r"^\s*([-+0-9.eE]+)", str(d["variables"].get(var, "")))
|
|
209
|
+
return want is None or (got is not None and abs(float(got.group(1)) - want) <= 1e-9 * abs(want))
|
|
210
|
+
|
|
211
|
+
for port in job.get("ports", []):
|
|
212
|
+
n, kind = port["number"], port["kind"]
|
|
213
|
+
if analysis == "q3d_cmatrix":
|
|
214
|
+
continue
|
|
215
|
+
if kind == "junction":
|
|
216
|
+
b = rlc.get(f"LumpRLC_jj_{n}")
|
|
217
|
+
sp = sim_ports.get(n, {})
|
|
218
|
+
ok = (
|
|
219
|
+
b is not None
|
|
220
|
+
and b.get("UseInduct")
|
|
221
|
+
and b.get("Inductance") == f"Lj_{n}"
|
|
222
|
+
and same(f"Lj_{n}", sp.get("inductance"))
|
|
223
|
+
and same(f"Cj_{n}", sp.get("capacitance"))
|
|
224
|
+
)
|
|
225
|
+
add(
|
|
226
|
+
f"port {n} {port['name']}: junction RLC",
|
|
227
|
+
ok,
|
|
228
|
+
f"L={d['variables'].get(f'Lj_{n}')} C={d['variables'].get(f'Cj_{n}')}" if ok else "missing",
|
|
229
|
+
)
|
|
230
|
+
elif analysis in ("hfss_eigenmode", "eigenmode_epr"):
|
|
231
|
+
b = rlc.get(f"LumpRLC_term_{n}")
|
|
232
|
+
ok = b is not None and b.get("UseResist") and str(b.get("Resistance", "")).startswith("50")
|
|
233
|
+
add(f"port {n} {port['name']}: 50 Ω termination", ok, str(b.get("Resistance")) if b else "missing")
|
|
234
|
+
else: # driven: a terminal port (lumped on pads, wave port at the box edge)
|
|
235
|
+
b = bounds.get(str(n))
|
|
236
|
+
want = "Wave Port" if kind == "edge" else "Lumped Port"
|
|
237
|
+
add(
|
|
238
|
+
f"port {n} {port['name']}: {want}",
|
|
239
|
+
b is not None and b.get("BoundType") == want,
|
|
240
|
+
b.get("BoundType") if b else "missing",
|
|
241
|
+
)
|
|
242
|
+
if analysis == "q3d_cmatrix":
|
|
243
|
+
signal = {k: v for k, v in d["nets"].items() if v["type"] == "SignalNet"}
|
|
244
|
+
for exc, label in sorted(((int(k), v) for k, v in job.get("nets", {}).items())):
|
|
245
|
+
net = f"Net{exc}"
|
|
246
|
+
ok = net in signal and signal[net]["excitations"] == [exc]
|
|
247
|
+
add(f"net {net} = {label}", ok, f"objects {signal.get(net, {}).get('objects')}")
|
|
248
|
+
extra = sorted(set(signal) - {f"Net{k}" for k in job.get("nets", {})})
|
|
249
|
+
add("no unlabelled signal nets", not extra, ", ".join(extra))
|
|
250
|
+
settings = check_settings(info, analysis, job.get("settings", {}))
|
|
251
|
+
bad = [r["key"] for r in settings if r["ok"] is False]
|
|
252
|
+
add("settings read back", not bad, ", ".join(bad) or f"{sum(r['ok'] is True for r in settings)} keys")
|
|
253
|
+
return {"ok": all(c["ok"] for c in checks), "checks": checks, "settings": settings}
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def _kill_tree(pid: int) -> None:
|
|
257
|
+
"""Kill the process tree qcc started (never anything else)."""
|
|
258
|
+
if os.name == "nt":
|
|
259
|
+
subprocess.run(["taskkill", "/PID", str(pid), "/T", "/F"], capture_output=True, check=False)
|
|
260
|
+
else:
|
|
261
|
+
import signal # pylint: disable=import-outside-toplevel
|
|
262
|
+
|
|
263
|
+
try:
|
|
264
|
+
os.killpg(os.getpgid(pid), signal.SIGKILL)
|
|
265
|
+
except OSError:
|
|
266
|
+
pass
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
@dataclass
|
|
270
|
+
class AedtRun:
|
|
271
|
+
code: int
|
|
272
|
+
seconds: float
|
|
273
|
+
pid: int | None # the AEDT process (batch / gui) or the attached session
|
|
274
|
+
mode: str = "batch"
|
|
275
|
+
owned: bool = True
|
|
276
|
+
note: str = ""
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
def _finished(status_file: Path, grace: float = 3.0) -> bool:
|
|
280
|
+
"""The qcc script has ended (``end`` line; or ``done`` / ``error`` and no write for ``grace`` s)."""
|
|
281
|
+
if not status_file.exists():
|
|
282
|
+
return False
|
|
283
|
+
lines = status_file.read_text(encoding="utf-8", errors="replace").splitlines()
|
|
284
|
+
if "end" in lines:
|
|
285
|
+
return True
|
|
286
|
+
return ("done" in lines or "error" in lines) and time.time() - status_file.stat().st_mtime > grace
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
def run_aedt_mode(
|
|
290
|
+
job_dir: Path,
|
|
291
|
+
script: str,
|
|
292
|
+
executable: str | Path | None = None,
|
|
293
|
+
aedt: str | None = None,
|
|
294
|
+
timeout: float | None = None,
|
|
295
|
+
log_name: str = "render.log",
|
|
296
|
+
progress: float | None = None,
|
|
297
|
+
aedt_pid: int | None = None,
|
|
298
|
+
graphical: bool = False,
|
|
299
|
+
) -> AedtRun:
|
|
300
|
+
"""Run ``scripts/<script>`` on ``job_dir`` in AEDT the ``aedt`` way (see the module docstring), printing a
|
|
301
|
+
progress line every ``progress`` s; returns when the script has ended (a ``gui`` / ``attach`` window stays open)."""
|
|
302
|
+
job_dir = Path(job_dir)
|
|
303
|
+
mode = resolve_mode(aedt, graphical)
|
|
304
|
+
every = progress_interval(progress)
|
|
305
|
+
status_mode = SCRIPT_MODE.get(script, "render")
|
|
306
|
+
status_file = job_dir / STATUS_FILE[status_mode]
|
|
307
|
+
status_file.unlink(missing_ok=True) # a stale file would read as "finished"
|
|
308
|
+
job = read_job(job_dir)
|
|
309
|
+
sim_json = f"{job['simulation_name']}.json"
|
|
310
|
+
log_path = job_dir / log_name
|
|
311
|
+
session = None
|
|
312
|
+
note = ""
|
|
313
|
+
|
|
314
|
+
def say(msg):
|
|
315
|
+
if every:
|
|
316
|
+
echo(f"[aedt] {msg}")
|
|
317
|
+
|
|
318
|
+
if mode == "attach":
|
|
319
|
+
session = pick_session(find_sessions(), aedt_pid)
|
|
320
|
+
if session is None:
|
|
321
|
+
note = "no AEDT window open: opened a new one (as aedt='gui')"
|
|
322
|
+
say(note)
|
|
323
|
+
mode = "gui"
|
|
324
|
+
t0 = time.time()
|
|
325
|
+
proc, pid, owned = None, None, True
|
|
326
|
+
with log_path.open("w", encoding="utf-8") as log:
|
|
327
|
+
try:
|
|
328
|
+
if mode == "batch":
|
|
329
|
+
cmd = render_command(job_dir, Path(executable) if executable else None, script=script)
|
|
330
|
+
proc = subprocess.Popen( # noqa: S603
|
|
331
|
+
cmd,
|
|
332
|
+
cwd=job_dir,
|
|
333
|
+
env=aedt_env(),
|
|
334
|
+
stdout=log,
|
|
335
|
+
stderr=subprocess.STDOUT,
|
|
336
|
+
start_new_session=os.name != "nt",
|
|
337
|
+
)
|
|
338
|
+
pid = proc.pid
|
|
339
|
+
say(f"{status_mode} {job_dir.name}: new non-graphical AEDT pid {pid} (log {log_path.name})")
|
|
340
|
+
elif mode == "gui":
|
|
341
|
+
exe = Path(executable) if executable else find_ansys_executable()
|
|
342
|
+
if exe is None:
|
|
343
|
+
raise FileNotFoundError("AEDT 2024 (ansysedt, v241+) not found; set QCC_ANSYS_EXECUTABLE")
|
|
344
|
+
pid = launch_gui(exe, job_dir, script, sim_json)
|
|
345
|
+
if pid is None:
|
|
346
|
+
raise OSError("the new AEDT window did not start (no ansysedt process with this job's script)")
|
|
347
|
+
say(f"{status_mode} {job_dir.name}: new AEDT window pid {pid}; watch it there (it stays open)")
|
|
348
|
+
else:
|
|
349
|
+
owned = False
|
|
350
|
+
pid = session.pid
|
|
351
|
+
project = f"{job['simulation_name']}_project"
|
|
352
|
+
cmd = attach_command(session, job_dir / "scripts" / script, str(job_dir / sim_json), project)
|
|
353
|
+
proc = subprocess.Popen(cmd, cwd=job_dir, stdout=log, stderr=subprocess.STDOUT) # noqa: S603
|
|
354
|
+
say(f"{status_mode} {job_dir.name}: attached to {session.describe()}; watch the project {project} "
|
|
355
|
+
"there (released afterwards, left open)")
|
|
356
|
+
except OSError as e:
|
|
357
|
+
log.write(f"\n[qcc aedt] {type(e).__name__}: {e}\n")
|
|
358
|
+
say(f"could not start ({mode}): {e}")
|
|
359
|
+
return AedtRun(-1, time.time() - t0, pid, mode, owned, str(e))
|
|
360
|
+
# the pid of what qcc started (never the pid of an attached session: nobody should kill that one)
|
|
361
|
+
(job_dir / f"{log_name}.pid").write_text(str(proc.pid if mode == "attach" else pid), encoding="utf-8")
|
|
362
|
+
label = f"{mode} pid {pid}"
|
|
363
|
+
next_line = t0 + every if every else None
|
|
364
|
+
code = None
|
|
365
|
+
while code is None:
|
|
366
|
+
time.sleep(0.5)
|
|
367
|
+
now = time.time()
|
|
368
|
+
if proc is not None and proc.poll() is not None:
|
|
369
|
+
code = proc.returncode
|
|
370
|
+
elif mode == "gui" and _finished(status_file):
|
|
371
|
+
code = 0
|
|
372
|
+
elif mode == "gui" and not pid_alive(pid):
|
|
373
|
+
code, note = 1, "the AEDT window was closed before the script ended"
|
|
374
|
+
elif mode == "attach" and _finished(status_file, 30.0):
|
|
375
|
+
proc.kill() # the helper only; the script has ended inside the session
|
|
376
|
+
code = 0
|
|
377
|
+
elif timeout and now - t0 > timeout:
|
|
378
|
+
if mode == "attach":
|
|
379
|
+
proc.kill()
|
|
380
|
+
note = (f"timeout after {timeout:.0f} s: stopped waiting (helper killed); the run goes on in "
|
|
381
|
+
f"the attached AEDT pid {pid}: stop it there if needed")
|
|
382
|
+
else:
|
|
383
|
+
_kill_tree(pid)
|
|
384
|
+
if proc is not None:
|
|
385
|
+
proc.wait()
|
|
386
|
+
note = f"timeout after {timeout:.0f} s: killed own process tree {pid}"
|
|
387
|
+
log.write(f"\n[qcc aedt] {note}\n")
|
|
388
|
+
code = -1
|
|
389
|
+
if next_line is not None and (code is not None or now >= next_line):
|
|
390
|
+
echo(format_progress(read_progress(job_dir, status_mode), now - t0, label))
|
|
391
|
+
next_line = now + every
|
|
392
|
+
if mode != "batch" and code == 0 and "done" not in render_status(job_dir, status_mode):
|
|
393
|
+
code = 1
|
|
394
|
+
if note:
|
|
395
|
+
say(note)
|
|
396
|
+
return AedtRun(code, time.time() - t0, pid, mode, owned, note)
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
def run_aedt(
|
|
400
|
+
job_dir: Path,
|
|
401
|
+
script: str,
|
|
402
|
+
executable: str | Path | None = None,
|
|
403
|
+
graphical: bool = False,
|
|
404
|
+
timeout: float | None = None,
|
|
405
|
+
log_name: str = "render.log",
|
|
406
|
+
aedt: str | None = None,
|
|
407
|
+
progress: float | None = None,
|
|
408
|
+
) -> tuple[int, float, int | None]:
|
|
409
|
+
""":func:`run_aedt_mode` as (return code, seconds, pid) (``graphical=True`` = ``aedt="gui"``)."""
|
|
410
|
+
r = run_aedt_mode(job_dir, script, executable, aedt, timeout, log_name, progress, graphical=graphical)
|
|
411
|
+
return r.code, r.seconds, r.pid
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
def render(
|
|
415
|
+
source,
|
|
416
|
+
group: str = CHIP_GROUP,
|
|
417
|
+
analysis: str = "eigenmode_epr", # decision #31: eigenmode/EPR is the default
|
|
418
|
+
job_dir: str | Path | None = None,
|
|
419
|
+
jobs_root: str | Path = "build/jobs",
|
|
420
|
+
overwrite: bool = True,
|
|
421
|
+
solve: bool = False,
|
|
422
|
+
open_gui: bool = False,
|
|
423
|
+
graphical: bool = False,
|
|
424
|
+
timeout: float | None = None,
|
|
425
|
+
executable: str | Path | None = None,
|
|
426
|
+
airbridges: bool | None = None,
|
|
427
|
+
aedt: str | None = None,
|
|
428
|
+
progress: float | None = None,
|
|
429
|
+
aedt_pid: int | None = None,
|
|
430
|
+
**settings,
|
|
431
|
+
) -> RenderResult:
|
|
432
|
+
"""Build ``group`` of ``source`` and render it into an AEDT project (see module docstring); ``solve=True`` also
|
|
433
|
+
solves it and collects the results. ``timeout`` (s) defaults to 30 min for a render and 6 h for a solve; on a
|
|
434
|
+
timeout only the AEDT process tree started here is killed. ``airbridges`` keeps (True) or drops (default, or the
|
|
435
|
+
group's ``settings["airbridges"]``) airbridge geometry; ``settings`` override the solver defaults. ``aedt``:
|
|
436
|
+
``"batch"`` | ``"gui"`` | ``"attach"`` (module docstring); ``progress``: seconds between progress lines."""
|
|
437
|
+
if timeout is None:
|
|
438
|
+
timeout = 6 * 3600 if solve else 1800
|
|
439
|
+
if solver_of(analysis) != "ansys":
|
|
440
|
+
raise ValueError(f"{analysis} is not an Ansys analysis")
|
|
441
|
+
with _track.stage("render", Path(job_dir).name if job_dir else f"{group}_{analysis}") as st:
|
|
442
|
+
setup = build_simulation(source, group, analysis, airbridges=airbridges)
|
|
443
|
+
job_dir = Path(job_dir or Path(jobs_root) / setup.simulation.name).resolve()
|
|
444
|
+
export_job(
|
|
445
|
+
setup, job_dir, overwrite=overwrite, **({"ansys_executable": executable} if executable else {}), **settings
|
|
446
|
+
)
|
|
447
|
+
if solve:
|
|
448
|
+
res = solve_job(
|
|
449
|
+
job_dir,
|
|
450
|
+
executable=executable,
|
|
451
|
+
graphical=graphical,
|
|
452
|
+
timeout=timeout,
|
|
453
|
+
open_gui=open_gui,
|
|
454
|
+
aedt=aedt,
|
|
455
|
+
progress=progress,
|
|
456
|
+
aedt_pid=aedt_pid,
|
|
457
|
+
)
|
|
458
|
+
if not res.ok:
|
|
459
|
+
st.fail(f"solve failed (see {res.log})")
|
|
460
|
+
return res
|
|
461
|
+
write_scripts(job_dir)
|
|
462
|
+
run = run_aedt_mode(job_dir, RENDER_SCRIPT, executable, aedt, timeout, "render.log", progress, aedt_pid, graphical)
|
|
463
|
+
project = _project_path(job_dir)
|
|
464
|
+
result = RenderResult(
|
|
465
|
+
job_dir,
|
|
466
|
+
project,
|
|
467
|
+
job_dir / "render.log",
|
|
468
|
+
run.code,
|
|
469
|
+
run.seconds,
|
|
470
|
+
_summary(project),
|
|
471
|
+
render_status(job_dir),
|
|
472
|
+
pid=run.pid,
|
|
473
|
+
mode=run.mode,
|
|
474
|
+
owned=run.owned,
|
|
475
|
+
note=run.note,
|
|
476
|
+
)
|
|
477
|
+
if not result.ok:
|
|
478
|
+
st.fail(f"render failed (see {result.log})")
|
|
479
|
+
st.note = f"rendered in {run.seconds:.0f} s"
|
|
480
|
+
update_job(
|
|
481
|
+
job_dir,
|
|
482
|
+
status="rendered" if result.ok else "render_failed",
|
|
483
|
+
render_seconds=round(run.seconds, 1),
|
|
484
|
+
aedt_mode=run.mode,
|
|
485
|
+
)
|
|
486
|
+
if open_gui and result.ok and run.mode == "batch": # gui / attach: the project is open in a window already
|
|
487
|
+
open_project(project, executable)
|
|
488
|
+
return result
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
def solve_job(
|
|
492
|
+
job_dir: str | Path,
|
|
493
|
+
executable: str | Path | None = None,
|
|
494
|
+
graphical: bool = False,
|
|
495
|
+
timeout: float | None = None,
|
|
496
|
+
open_gui: bool = False,
|
|
497
|
+
aedt: str | None = None,
|
|
498
|
+
progress: float | None = None,
|
|
499
|
+
aedt_pid: int | None = None,
|
|
500
|
+
) -> RenderResult:
|
|
501
|
+
"""Solve an exported Ansys job directory, then collect its results (``results.json``). ``aedt``: ``"batch"``
|
|
502
|
+
(default: a new non-graphical AEDT) | ``"gui"`` (a new AEDT window, left open) | ``"attach"`` (the open AEDT
|
|
503
|
+
window, else a new one); a progress line every ``progress`` s (default 30, 0 = quiet)."""
|
|
504
|
+
from quantcore_circuits.analysis.results import collect_results # pylint: disable=import-outside-toplevel
|
|
505
|
+
|
|
506
|
+
job_dir = Path(job_dir).resolve()
|
|
507
|
+
write_scripts(job_dir)
|
|
508
|
+
update_job(job_dir, status="solving", started=time.time())
|
|
509
|
+
run = run_aedt_mode(job_dir, SOLVE_SCRIPT, executable, aedt, timeout, "solve.log", progress, aedt_pid, graphical)
|
|
510
|
+
code, seconds = run.code, run.seconds
|
|
511
|
+
status = render_status(job_dir, "solve")
|
|
512
|
+
project = _project_path(job_dir)
|
|
513
|
+
results = collect_results(job_dir)
|
|
514
|
+
result = RenderResult(
|
|
515
|
+
job_dir,
|
|
516
|
+
project,
|
|
517
|
+
job_dir / "solve.log",
|
|
518
|
+
code,
|
|
519
|
+
seconds,
|
|
520
|
+
_summary(project),
|
|
521
|
+
status,
|
|
522
|
+
results,
|
|
523
|
+
run.pid,
|
|
524
|
+
run.mode,
|
|
525
|
+
run.owned,
|
|
526
|
+
run.note,
|
|
527
|
+
)
|
|
528
|
+
have = any(k in results for k in ("cmatrix", "eigenmodes", "sparams"))
|
|
529
|
+
update_job(
|
|
530
|
+
job_dir,
|
|
531
|
+
status="done" if result.ok and have else "failed",
|
|
532
|
+
returncode=code,
|
|
533
|
+
solve_seconds=round(seconds, 1),
|
|
534
|
+
finished=time.time(),
|
|
535
|
+
aedt_mode=run.mode,
|
|
536
|
+
)
|
|
537
|
+
if open_gui and result.ok and run.mode == "batch":
|
|
538
|
+
open_project(project, executable)
|
|
539
|
+
return result
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
solve = solve_job
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
def collect_job(
|
|
546
|
+
job_dir: str | Path,
|
|
547
|
+
executable: str | Path | None = None,
|
|
548
|
+
aedt: str | None = "batch",
|
|
549
|
+
timeout: float | None = 1800.0,
|
|
550
|
+
progress: float | None = None,
|
|
551
|
+
) -> RenderResult:
|
|
552
|
+
"""Re-export a solved job from its saved project as it is now (no import, no solve; e.g. after the setup was
|
|
553
|
+
changed and solved again in AEDT), then collect the results. ``aedt="batch"`` opens the saved project in a new
|
|
554
|
+
non-graphical AEDT (close it in your own AEDT first, or run ``scripts/qcc_collect.py`` there instead)."""
|
|
555
|
+
from quantcore_circuits.analysis.results import collect_results # pylint: disable=import-outside-toplevel
|
|
556
|
+
|
|
557
|
+
job_dir = Path(job_dir).resolve()
|
|
558
|
+
project = _project_path(job_dir)
|
|
559
|
+
if not project.exists():
|
|
560
|
+
raise FileNotFoundError(f"{job_dir}: no saved project {project.name} (render or solve the job first)")
|
|
561
|
+
write_scripts(job_dir)
|
|
562
|
+
run = run_aedt_mode(job_dir, COLLECT_SCRIPT, executable, aedt, timeout, "collect.log", progress)
|
|
563
|
+
results = collect_results(job_dir)
|
|
564
|
+
return RenderResult(job_dir, project, job_dir / "collect.log", run.code, run.seconds, _summary(project),
|
|
565
|
+
render_status(job_dir, "collect"), results, run.pid, run.mode, run.owned, run.note)
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
def open_project(project: str | Path, executable: str | Path | None = None) -> subprocess.Popen:
|
|
569
|
+
"""Open ``project`` in a new AEDT GUI window (detached)."""
|
|
570
|
+
exe = Path(executable) if executable else find_ansys_executable()
|
|
571
|
+
if exe is None:
|
|
572
|
+
raise FileNotFoundError("ansysedt not found")
|
|
573
|
+
flags = subprocess.DETACHED_PROCESS if os.name == "nt" else 0
|
|
574
|
+
return subprocess.Popen([str(exe), str(project)], cwd=Path(project).parent, creationflags=flags) # noqa: S603
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
def _project_path(job_dir: Path) -> Path | None:
|
|
578
|
+
hits = sorted(Path(job_dir).glob("*_project.aedt"))
|
|
579
|
+
return hits[0] if hits else None
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
def _summary(project: Path | None) -> dict:
|
|
583
|
+
return aedt_summary(project) if project is not None and project.exists() else {}
|