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.
Files changed (272) hide show
  1. quantcore_circuits/__init__.py +57 -0
  2. quantcore_circuits/analysis/__init__.py +12 -0
  3. quantcore_circuits/analysis/_metal.py +70 -0
  4. quantcore_circuits/analysis/amplifiers.py +263 -0
  5. quantcore_circuits/analysis/circuits.py +117 -0
  6. quantcore_circuits/analysis/epr.py +231 -0
  7. quantcore_circuits/analysis/epr_lumped.py +372 -0
  8. quantcore_circuits/analysis/extract.py +119 -0
  9. quantcore_circuits/analysis/lom.py +80 -0
  10. quantcore_circuits/analysis/results.py +549 -0
  11. quantcore_circuits/analysis/store.py +81 -0
  12. quantcore_circuits/analysis/synthesis.py +118 -0
  13. quantcore_circuits/analysis/transmon.py +126 -0
  14. quantcore_circuits/assembly/__init__.py +17 -0
  15. quantcore_circuits/assembly/builder.py +127 -0
  16. quantcore_circuits/assembly/drc.py +683 -0
  17. quantcore_circuits/assembly/last_good.py +137 -0
  18. quantcore_circuits/assembly/netlist.py +174 -0
  19. quantcore_circuits/assembly/plan.py +605 -0
  20. quantcore_circuits/assembly/sidecar.py +270 -0
  21. quantcore_circuits/autotrack.py +605 -0
  22. quantcore_circuits/cards.py +878 -0
  23. quantcore_circuits/circuit/__init__.py +14 -0
  24. quantcore_circuits/circuit/adapters.py +305 -0
  25. quantcore_circuits/circuit/bridges.py +353 -0
  26. quantcore_circuits/circuit/consensus.py +158 -0
  27. quantcore_circuits/circuit/derive.py +28 -0
  28. quantcore_circuits/circuit/draw.py +198 -0
  29. quantcore_circuits/circuit/fill.py +828 -0
  30. quantcore_circuits/circuit/hamiltonian.py +193 -0
  31. quantcore_circuits/circuit/kinetic.py +102 -0
  32. quantcore_circuits/circuit/schema.py +139 -0
  33. quantcore_circuits/cli.py +1085 -0
  34. quantcore_circuits/codesign.py +1038 -0
  35. quantcore_circuits/data/selftest_q1_r1.json +44 -0
  36. quantcore_circuits/design/__init__.py +44 -0
  37. quantcore_circuits/design/io.py +98 -0
  38. quantcore_circuits/design/pyscript.py +395 -0
  39. quantcore_circuits/design/schema.py +398 -0
  40. quantcore_circuits/designer.py +625 -0
  41. quantcore_circuits/guiflow.py +991 -0
  42. quantcore_circuits/kqc_files.py +208 -0
  43. quantcore_circuits/layouts/__init__.py +118 -0
  44. quantcore_circuits/layouts/catalog.py +520 -0
  45. quantcore_circuits/layouts/chips/__init__.py +0 -0
  46. quantcore_circuits/layouts/chips/design_chip.py +325 -0
  47. quantcore_circuits/layouts/chips/frame.py +235 -0
  48. quantcore_circuits/layouts/junctions/__init__.py +0 -0
  49. quantcore_circuits/layouts/junctions/jj_fingers.py +99 -0
  50. quantcore_circuits/layouts/junctions/legacy_junctions.py +237 -0
  51. quantcore_circuits/layouts/junctions/sim_gap.py +48 -0
  52. quantcore_circuits/layouts/junctions/trilayer.py +541 -0
  53. quantcore_circuits/layouts/metal/__init__.py +105 -0
  54. quantcore_circuits/layouts/metal/component.py +332 -0
  55. quantcore_circuits/layouts/metal/geometry.py +462 -0
  56. quantcore_circuits/layouts/others/__init__.py +0 -0
  57. quantcore_circuits/layouts/others/amplifiers.py +1139 -0
  58. quantcore_circuits/layouts/others/bond_pad.py +119 -0
  59. quantcore_circuits/layouts/others/connector_pads.py +190 -0
  60. quantcore_circuits/layouts/others/couplers.py +21 -0
  61. quantcore_circuits/layouts/others/cpw_segment.py +131 -0
  62. quantcore_circuits/layouts/others/cpwe.py +661 -0
  63. quantcore_circuits/layouts/others/keepout.py +66 -0
  64. quantcore_circuits/layouts/others/legacy_resonators.py +645 -0
  65. quantcore_circuits/layouts/others/markers.py +201 -0
  66. quantcore_circuits/layouts/others/qpdk_cells.py +263 -0
  67. quantcore_circuits/layouts/others/shapes.py +114 -0
  68. quantcore_circuits/layouts/others/spirals.py +140 -0
  69. quantcore_circuits/layouts/others/sqdmetal_cells.py +90 -0
  70. quantcore_circuits/layouts/others/test_pads.py +461 -0
  71. quantcore_circuits/layouts/ports.py +119 -0
  72. quantcore_circuits/layouts/qubits/__init__.py +0 -0
  73. quantcore_circuits/layouts/qubits/legacy_transmon.py +124 -0
  74. quantcore_circuits/layouts/qubits/qpdk_cells.py +374 -0
  75. quantcore_circuits/layouts/qubits/sqdmetal_cells.py +376 -0
  76. quantcore_circuits/layouts/qubits/trilayer_concentric.py +65 -0
  77. quantcore_circuits/layouts/qubits/xmon.py +375 -0
  78. quantcore_circuits/layouts/registry.py +418 -0
  79. quantcore_circuits/layouts/wafers/__init__.py +0 -0
  80. quantcore_circuits/layouts/wafers/fab_export.py +454 -0
  81. quantcore_circuits/layouts/wafers/legacy_wafer.py +111 -0
  82. quantcore_circuits/layouts/wafers/wafer.py +469 -0
  83. quantcore_circuits/live/__init__.py +6 -0
  84. quantcore_circuits/live/klayout.py +225 -0
  85. quantcore_circuits/live/klive.py +61 -0
  86. quantcore_circuits/live/snapshot.py +185 -0
  87. quantcore_circuits/live/watch.py +93 -0
  88. quantcore_circuits/lom/__init__.py +15 -0
  89. quantcore_circuits/lom/builder.py +932 -0
  90. quantcore_circuits/lom/calibration.py +82 -0
  91. quantcore_circuits/lom/estimates.py +235 -0
  92. quantcore_circuits/lom/fragment.py +421 -0
  93. quantcore_circuits/lom/kqc_models.py +734 -0
  94. quantcore_circuits/lom/metal_models.py +917 -0
  95. quantcore_circuits/lom/quantcore_models.py +784 -0
  96. quantcore_circuits/lom/simulate.py +636 -0
  97. quantcore_circuits/lom/synthesize.py +189 -0
  98. quantcore_circuits/loop.py +610 -0
  99. quantcore_circuits/optimise.py +423 -0
  100. quantcore_circuits/pdk/__init__.py +451 -0
  101. quantcore_circuits/plots.py +876 -0
  102. quantcore_circuits/plugins.py +69 -0
  103. quantcore_circuits/review/__init__.py +57 -0
  104. quantcore_circuits/review/server.py +251 -0
  105. quantcore_circuits/review/static/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  106. quantcore_circuits/review/static/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  107. quantcore_circuits/review/static/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  108. quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  109. quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  110. quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  111. quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  112. quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  113. quantcore_circuits/review/static/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  114. quantcore_circuits/review/static/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  115. quantcore_circuits/review/static/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  116. quantcore_circuits/review/static/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  117. quantcore_circuits/review/static/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  118. quantcore_circuits/review/static/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  119. quantcore_circuits/review/static/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  120. quantcore_circuits/review/static/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  121. quantcore_circuits/review/static/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  122. quantcore_circuits/review/static/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  123. quantcore_circuits/review/static/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  124. quantcore_circuits/review/static/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  125. quantcore_circuits/review/static/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  126. quantcore_circuits/review/static/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  127. quantcore_circuits/review/static/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  128. quantcore_circuits/review/static/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  129. quantcore_circuits/review/static/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  130. quantcore_circuits/review/static/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  131. quantcore_circuits/review/static/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  132. quantcore_circuits/review/static/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  133. quantcore_circuits/review/static/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  134. quantcore_circuits/review/static/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  135. quantcore_circuits/review/static/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  136. quantcore_circuits/review/static/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  137. quantcore_circuits/review/static/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  138. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  139. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  140. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  141. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  142. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  143. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  144. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  145. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  146. quantcore_circuits/review/static/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  147. quantcore_circuits/review/static/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  148. quantcore_circuits/review/static/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  149. quantcore_circuits/review/static/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  150. quantcore_circuits/review/static/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  151. quantcore_circuits/review/static/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  152. quantcore_circuits/review/static/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  153. quantcore_circuits/review/static/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  154. quantcore_circuits/review/static/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  155. quantcore_circuits/review/static/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  156. quantcore_circuits/review/static/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  157. quantcore_circuits/review/static/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  158. quantcore_circuits/review/static/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  159. quantcore_circuits/review/static/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  160. quantcore_circuits/review/static/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  161. quantcore_circuits/review/static/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  162. quantcore_circuits/review/static/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  163. quantcore_circuits/review/static/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  164. quantcore_circuits/review/static/assets/index-CDHdrFyA.css +1 -0
  165. quantcore_circuits/review/static/assets/index-CSx05Og4.js +409 -0
  166. quantcore_circuits/review/static/assets/inter-cyrillic-400-normal-HOLc17fK.woff +0 -0
  167. quantcore_circuits/review/static/assets/inter-cyrillic-400-normal-obahsSVq.woff2 +0 -0
  168. quantcore_circuits/review/static/assets/inter-cyrillic-500-normal-BasfLYem.woff2 +0 -0
  169. quantcore_circuits/review/static/assets/inter-cyrillic-500-normal-CxZf_p3X.woff +0 -0
  170. quantcore_circuits/review/static/assets/inter-cyrillic-600-normal-4D_pXhcN.woff +0 -0
  171. quantcore_circuits/review/static/assets/inter-cyrillic-600-normal-CWCymEST.woff2 +0 -0
  172. quantcore_circuits/review/static/assets/inter-cyrillic-700-normal-CjBOestx.woff2 +0 -0
  173. quantcore_circuits/review/static/assets/inter-cyrillic-700-normal-DrXBdSj3.woff +0 -0
  174. quantcore_circuits/review/static/assets/inter-cyrillic-ext-400-normal-BQZuk6qB.woff2 +0 -0
  175. quantcore_circuits/review/static/assets/inter-cyrillic-ext-400-normal-DQukG94-.woff +0 -0
  176. quantcore_circuits/review/static/assets/inter-cyrillic-ext-500-normal-B0yAr1jD.woff2 +0 -0
  177. quantcore_circuits/review/static/assets/inter-cyrillic-ext-500-normal-BmqWE9Dz.woff +0 -0
  178. quantcore_circuits/review/static/assets/inter-cyrillic-ext-600-normal-Bcila6Z-.woff +0 -0
  179. quantcore_circuits/review/static/assets/inter-cyrillic-ext-600-normal-Dfes3d0z.woff2 +0 -0
  180. quantcore_circuits/review/static/assets/inter-cyrillic-ext-700-normal-BjwYoWNd.woff2 +0 -0
  181. quantcore_circuits/review/static/assets/inter-cyrillic-ext-700-normal-LO58E6JB.woff +0 -0
  182. quantcore_circuits/review/static/assets/inter-greek-400-normal-B4URO6DV.woff2 +0 -0
  183. quantcore_circuits/review/static/assets/inter-greek-400-normal-q2sYcFCs.woff +0 -0
  184. quantcore_circuits/review/static/assets/inter-greek-500-normal-BIZE56-Y.woff2 +0 -0
  185. quantcore_circuits/review/static/assets/inter-greek-500-normal-Xzm54t5V.woff +0 -0
  186. quantcore_circuits/review/static/assets/inter-greek-600-normal-BZpKdvQh.woff +0 -0
  187. quantcore_circuits/review/static/assets/inter-greek-600-normal-plRanbMR.woff2 +0 -0
  188. quantcore_circuits/review/static/assets/inter-greek-700-normal-BUv2fZ6O.woff +0 -0
  189. quantcore_circuits/review/static/assets/inter-greek-700-normal-C3JjAnD8.woff2 +0 -0
  190. quantcore_circuits/review/static/assets/inter-greek-ext-400-normal-DGGRlc-M.woff2 +0 -0
  191. quantcore_circuits/review/static/assets/inter-greek-ext-400-normal-KugGGMne.woff +0 -0
  192. quantcore_circuits/review/static/assets/inter-greek-ext-500-normal-2j5mBUwD.woff +0 -0
  193. quantcore_circuits/review/static/assets/inter-greek-ext-500-normal-C4iEst2y.woff2 +0 -0
  194. quantcore_circuits/review/static/assets/inter-greek-ext-600-normal-B8X0CLgF.woff +0 -0
  195. quantcore_circuits/review/static/assets/inter-greek-ext-600-normal-DRtmH8MT.woff2 +0 -0
  196. quantcore_circuits/review/static/assets/inter-greek-ext-700-normal-BoQ6DsYi.woff +0 -0
  197. quantcore_circuits/review/static/assets/inter-greek-ext-700-normal-qfdV9bQt.woff2 +0 -0
  198. quantcore_circuits/review/static/assets/inter-latin-400-normal-C38fXH4l.woff2 +0 -0
  199. quantcore_circuits/review/static/assets/inter-latin-400-normal-CyCys3Eg.woff +0 -0
  200. quantcore_circuits/review/static/assets/inter-latin-500-normal-BL9OpVg8.woff +0 -0
  201. quantcore_circuits/review/static/assets/inter-latin-500-normal-Cerq10X2.woff2 +0 -0
  202. quantcore_circuits/review/static/assets/inter-latin-600-normal-CiBQ2DWP.woff +0 -0
  203. quantcore_circuits/review/static/assets/inter-latin-600-normal-LgqL8muc.woff2 +0 -0
  204. quantcore_circuits/review/static/assets/inter-latin-700-normal-BLAVimhd.woff +0 -0
  205. quantcore_circuits/review/static/assets/inter-latin-700-normal-Yt3aPRUw.woff2 +0 -0
  206. quantcore_circuits/review/static/assets/inter-latin-ext-400-normal-77YHD8bZ.woff +0 -0
  207. quantcore_circuits/review/static/assets/inter-latin-ext-400-normal-C1nco2VV.woff2 +0 -0
  208. quantcore_circuits/review/static/assets/inter-latin-ext-500-normal-BxGbmqWO.woff +0 -0
  209. quantcore_circuits/review/static/assets/inter-latin-ext-500-normal-CV4jyFjo.woff2 +0 -0
  210. quantcore_circuits/review/static/assets/inter-latin-ext-600-normal-CIVaiw4L.woff +0 -0
  211. quantcore_circuits/review/static/assets/inter-latin-ext-600-normal-D2bJ5OIk.woff2 +0 -0
  212. quantcore_circuits/review/static/assets/inter-latin-ext-700-normal-Ca8adRJv.woff2 +0 -0
  213. quantcore_circuits/review/static/assets/inter-latin-ext-700-normal-TidjK2hL.woff +0 -0
  214. quantcore_circuits/review/static/assets/inter-vietnamese-400-normal-Bbgyi5SW.woff +0 -0
  215. quantcore_circuits/review/static/assets/inter-vietnamese-400-normal-DMkecbls.woff2 +0 -0
  216. quantcore_circuits/review/static/assets/inter-vietnamese-500-normal-DOriooB6.woff2 +0 -0
  217. quantcore_circuits/review/static/assets/inter-vietnamese-500-normal-mJboJaSs.woff +0 -0
  218. quantcore_circuits/review/static/assets/inter-vietnamese-600-normal-BuLX-rYi.woff +0 -0
  219. quantcore_circuits/review/static/assets/inter-vietnamese-600-normal-Cc8MFFhd.woff2 +0 -0
  220. quantcore_circuits/review/static/assets/inter-vietnamese-700-normal-BZaoP0fm.woff +0 -0
  221. quantcore_circuits/review/static/assets/inter-vietnamese-700-normal-DlLaEgI2.woff2 +0 -0
  222. quantcore_circuits/review/static/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
  223. quantcore_circuits/review/static/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
  224. quantcore_circuits/review/static/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
  225. quantcore_circuits/review/static/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
  226. quantcore_circuits/review/static/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
  227. quantcore_circuits/review/static/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
  228. quantcore_circuits/review/static/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
  229. quantcore_circuits/review/static/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
  230. quantcore_circuits/review/static/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  231. quantcore_circuits/review/static/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  232. quantcore_circuits/review/static/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  233. quantcore_circuits/review/static/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
  234. quantcore_circuits/review/static/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  235. quantcore_circuits/review/static/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
  236. quantcore_circuits/review/static/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
  237. quantcore_circuits/review/static/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
  238. quantcore_circuits/review/static/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
  239. quantcore_circuits/review/static/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
  240. quantcore_circuits/review/static/index.html +14 -0
  241. quantcore_circuits/review/static/logo-quantcore-black.png +0 -0
  242. quantcore_circuits/review/static/logo-quantcore-white.png +0 -0
  243. quantcore_circuits/review/static/sample/chip.png +0 -0
  244. quantcore_circuits/review/static/sample/chip_rev1.png +0 -0
  245. quantcore_circuits/review/static/sample/q1.png +0 -0
  246. quantcore_circuits/review/static/sample/q2.png +0 -0
  247. quantcore_circuits/review/static/sample-state.json +3747 -0
  248. quantcore_circuits/route/__init__.py +5 -0
  249. quantcore_circuits/route/router.py +694 -0
  250. quantcore_circuits/route/waveguide.py +187 -0
  251. quantcore_circuits/selftest.py +224 -0
  252. quantcore_circuits/sim_tools/__init__.py +6 -0
  253. quantcore_circuits/sim_tools/aedt_attach.py +66 -0
  254. quantcore_circuits/sim_tools/aedt_progress.py +224 -0
  255. quantcore_circuits/sim_tools/aedt_project.py +302 -0
  256. quantcore_circuits/sim_tools/aedt_scripts.py +397 -0
  257. quantcore_circuits/sim_tools/aedt_session.py +275 -0
  258. quantcore_circuits/sim_tools/ansys.py +90 -0
  259. quantcore_circuits/sim_tools/builder.py +1690 -0
  260. quantcore_circuits/sim_tools/export.py +470 -0
  261. quantcore_circuits/sim_tools/geometry_check.py +342 -0
  262. quantcore_circuits/sim_tools/hfss.py +583 -0
  263. quantcore_circuits/sim_tools/palace.py +197 -0
  264. quantcore_circuits/sim_tools/runner.py +179 -0
  265. quantcore_circuits/sim_tools/subset.py +364 -0
  266. quantcore_circuits/track.py +671 -0
  267. quantcore_circuits-0.0.1.dist-info/METADATA +204 -0
  268. quantcore_circuits-0.0.1.dist-info/RECORD +272 -0
  269. quantcore_circuits-0.0.1.dist-info/WHEEL +5 -0
  270. quantcore_circuits-0.0.1.dist-info/entry_points.txt +2 -0
  271. quantcore_circuits-0.0.1.dist-info/licenses/LICENSE +674 -0
  272. quantcore_circuits-0.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,187 @@
1
+ """KQC ``WaveguideComposite`` with a bend radius per corner.
2
+
3
+ KQC's ``WaveguideComposite`` bends every corner of a straight-waveguide stretch with one radius ``r``; a node's own
4
+ ``r`` only takes effect on element nodes (tapers, airbridges, ...) and then for the rest of the route. A route with
5
+ per-corner radii (``Waypoint.r``) is built with :class:`WaveguideCompositeCorners` instead: its plain nodes may carry
6
+ ``corner_r`` (µm), the radius of the bend *at that node only*. Where two neighbouring corners differ, the stretch is
7
+ split into separate ``WaveguideCoplanar`` pieces in the middle of the straight between them (between the two bend
8
+ cuts), so each piece rounds its corners with its own radius. Routes without ``corner_r`` keep the stock KQC class,
9
+ so existing designs build exactly as before.
10
+
11
+ Joins (:func:`joined_nodes`): where a route ends at a cell's port, its gap strips and the cell's etch meet along
12
+ one line. Both are snapped to the 1 nm grid on their own, so at an angled port (a ConcentricTransmon coupler at 60°,
13
+ a Metal tee at 45°) or a port half a grid step off (an Xmon claw at y = ….4625 µm) they can miss each other by
14
+ less than 1 nm. The build then keeps the strip a separate polygon behind a zero-width metal crack, and the fab
15
+ export's corner rounding (per polygon) opens the crack into metal slivers (~0.5 µm² each). Such an end is drawn
16
+ :data:`JOIN_SHIFT` into the cell, so its strips overlap the cell's etch; the route's port refpoints stay on the
17
+ cell's port and the plan's route length is unchanged (the drawn route is 10 nm longer). Ends that already merge are
18
+ drawn as before.
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ from math import acos, pi, tan
24
+
25
+ from kqcircuits.elements.waveguide_composite import WaveguideComposite
26
+ from kqcircuits.pya_resolver import pya
27
+
28
+ CORNER_R = "corner_r" # node parameter: bend radius of this node's corner only
29
+ _EPS = 1e-6
30
+
31
+
32
+ def has_corner_radii(nodes) -> bool:
33
+ return any(CORNER_R in (n.params or {}) for n in nodes)
34
+
35
+
36
+ def waveguide_class(nodes):
37
+ """The cell class for a route with these KQC nodes: :class:`WaveguideCompositeCorners` when a node sets its own
38
+ corner radius, else KQC's ``WaveguideComposite``."""
39
+ if has_corner_radii(nodes):
40
+ ensure_registered()
41
+ return WaveguideCompositeCorners
42
+ return WaveguideComposite
43
+
44
+
45
+ def _turn(v1: pya.DVector, v2: pya.DVector) -> float:
46
+ c = v1.sprod(v2) / (v1.length() * v2.length())
47
+ return acos(max(-1.0, min(1.0, c)))
48
+
49
+
50
+ class WaveguideCompositeCorners(WaveguideComposite):
51
+ """``WaveguideComposite`` whose plain nodes may set the bend radius of their own corner (node param
52
+ ``corner_r``)."""
53
+
54
+ def _add_waveguide(self, end_index, end_pos=None, end_dir=None):
55
+ start = self._wg_start_idx
56
+ if end_index <= start:
57
+ return super()._add_waveguide(end_index, end_pos, end_dir)
58
+ route_r = self.r
59
+ nodes = self._nodes
60
+ last = end_pos if end_pos is not None else nodes[end_index].position
61
+ pos = [self._wg_start_pos] + [nodes[k].position for k in range(start + 1, end_index)] + [last]
62
+ corners = [] # (j in pos, radius, cut)
63
+ for j in range(1, len(pos) - 1):
64
+ v1, v2 = pos[j] - pos[j - 1], pos[j + 1] - pos[j]
65
+ if v1.length() < _EPS or v2.length() < _EPS:
66
+ continue
67
+ theta = _turn(v1, v2)
68
+ if theta < 1e-9:
69
+ continue
70
+ rad = float(nodes[start + j].params.get(CORNER_R, route_r))
71
+ corners.append((j, rad, rad * tan(min(theta, pi - 1e-9) / 2)))
72
+ split = next((i for i in range(len(corners) - 1) if abs(corners[i][1] - corners[i + 1][1]) > _EPS), None)
73
+ if split is None: # one radius for the whole stretch
74
+ if corners:
75
+ self.r = corners[0][1]
76
+ try:
77
+ super()._add_waveguide(end_index, end_pos, end_dir)
78
+ finally:
79
+ self.r = route_r
80
+ return None
81
+ (ja, ra, cut_a), (jb, _rb, cut_b) = corners[split], corners[split + 1]
82
+ straight = pos[jb] - pos[ja]
83
+ length = straight.length()
84
+ direction = straight / length
85
+ s_split = cut_a + max(0.0, length - cut_a - cut_b) / 2 # middle of the straight between the two bends
86
+ acc = 0.0
87
+ for j in range(ja + 1, jb + 1):
88
+ seg = (pos[j] - pos[j - 1]).length()
89
+ if abs(acc + seg - s_split) < _EPS and j < jb: # the split falls on a collinear node: end there
90
+ self.r = ra
91
+ try:
92
+ super()._add_waveguide(start + j)
93
+ finally:
94
+ self.r = route_r
95
+ break
96
+ if s_split < acc + seg:
97
+ node = nodes[start + j]
98
+ saved = (node.length_before, node.length_increment)
99
+ node.length_before = node.length_increment = None # the meander goes on the second half only
100
+ self.r = ra
101
+ try:
102
+ super()._add_waveguide(start + j, pos[ja] + direction * s_split, direction)
103
+ finally:
104
+ node.length_before, node.length_increment = saved
105
+ self.r = route_r
106
+ self._wg_start_idx = start + j - 1 # the next piece runs from the split point to node start + j
107
+ break
108
+ acc += seg
109
+ else: # numerically no split point (cannot happen for a valid straight): one radius, as KQC would
110
+ return super()._add_waveguide(end_index, end_pos, end_dir)
111
+ return self._add_waveguide(end_index, end_pos, end_dir)
112
+
113
+
114
+ _registered = False
115
+
116
+
117
+ def ensure_registered() -> None:
118
+ """Register :class:`WaveguideCompositeCorners` in KQC's element library (idempotent)."""
119
+ global _registered # pylint: disable=global-statement
120
+ if _registered:
121
+ return
122
+ from quantcore_circuits.layouts import ensure_loaded, register_pcell_classes # pylint: disable=C0415
123
+
124
+ ensure_loaded()
125
+ register_pcell_classes([WaveguideCompositeCorners])
126
+ _registered = True
127
+
128
+
129
+ JOIN_SHIFT = 0.01 # µm: how far a route end that misses a cell's etch is drawn into the cell
130
+
131
+
132
+ def etch_near(cell: pya.Cell, trans: pya.ICplxTrans, layer: int, box: pya.Box) -> pya.Region:
133
+ """``cell``'s shapes on ``layer`` placed with ``trans``, within ``box`` (parent dbu)."""
134
+ local = box.transformed(trans.inverted())
135
+ return pya.Region(cell.begin_shapes_rec_touching(layer, local)).transformed(trans) & pya.Region(box)
136
+
137
+
138
+ def misses_etch(cell_etch: pya.Region, route_etch: pya.Region, direction: pya.DVector, dbu: float) -> bool:
139
+ """True if a piece of the route's etch neither overlaps nor touches the cell's etch (so the merge keeps it apart)
140
+ although the cell is etched within :data:`JOIN_SHIFT` behind it (``direction`` points along the route): a
141
+ hairline gap. A pin on solid metal, or a join that already merges, gives False."""
142
+ loose = route_etch.not_interacting(cell_etch)
143
+ if loose.is_empty():
144
+ return False
145
+ k = JOIN_SHIFT / dbu
146
+ behind = loose.minkowski_sum(pya.Edge(0, 0, -round(direction.x * k), -round(direction.y * k)))
147
+ return not (behind & cell_etch).is_empty()
148
+
149
+
150
+ def joined_nodes(route_cell: pya.Cell, nodes: list, node_strings: list, origin: pya.DVector, joins: list,
151
+ placed: dict, layer: int, half_width: float):
152
+ """Nodes for a route whose ends meet a cell's etch across a hairline (see the module docstring), or None.
153
+
154
+ ``route_cell`` is the route as built from ``nodes`` (relative to ``origin``), ``node_strings`` the plan's nodes,
155
+ ``joins`` the plan's ``[{"inst", "node": 0 | -1}]``, ``placed`` the chip's instances by name, ``layer`` the etch
156
+ layer and ``half_width`` the route's a/2 + b (µm). Returns ``(nodes, shifts)``: fresh nodes (relative to
157
+ ``origin``) with those ends moved :data:`JOIN_SHIFT` into the cell, and ``{"a" | "b": shift (µm)}`` per moved end.
158
+ """
159
+ from kqcircuits.util.node import Node # pylint: disable=import-outside-toplevel
160
+
161
+ layout = route_cell.layout()
162
+ dbu = layout.dbu
163
+ route_trans = pya.ICplxTrans(pya.Trans(pya.Vector(round(origin.x / dbu), round(origin.y / dbu))))
164
+ moved = {}
165
+ for join in joins:
166
+ inst = placed.get(join["inst"])
167
+ i = int(join["node"])
168
+ if inst is None or len(nodes) < 2:
169
+ continue
170
+ at, nxt = nodes[i].position + origin, nodes[1 if i == 0 else -2].position + origin
171
+ if (nxt - at).length() < _EPS:
172
+ continue
173
+ u = (nxt - at) / (nxt - at).length() # along the route, away from the cell
174
+ reach = half_width + 2.0
175
+ box = pya.DBox(at.x - reach, at.y - reach, at.x + reach, at.y + reach).to_itype(dbu)
176
+ cell_etch = etch_near(inst.cell, inst.cplx_trans, layer, box)
177
+ route_etch = etch_near(route_cell, route_trans, layer, box)
178
+ if not cell_etch.is_empty() and misses_etch(cell_etch, route_etch, u, dbu):
179
+ moved[i] = u * -JOIN_SHIFT
180
+ if not moved:
181
+ return None
182
+ fresh = Node.nodes_from_string(node_strings)
183
+ for node in fresh:
184
+ node.position = node.position - origin
185
+ for i, shift in moved.items():
186
+ fresh[i].position = fresh[i].position + shift
187
+ return fresh, {("a" if i == 0 else "b"): shift for i, shift in moved.items()}
@@ -0,0 +1,224 @@
1
+ """``qcc selftest``: does this install work?
2
+
3
+ pip cannot run tests while it installs, so this is the check to run right after an install (the install scripts in
4
+ ``scripts/install_sim_pc.*`` call it). One line per check, ``ok`` / ``FAIL`` / ``skip``; the exit code is non-zero when
5
+ any check failed. It never starts AEDT and runs no solver.
6
+
7
+ Checks: the imports of the core and of every extra (with versions), then a small Q1 + R1 chip shipped as package data
8
+ (``data/selftest_q1_r1.json``): build, DRC, the layout LOM netlist, a LOM simulation (needs the ``analysis`` extra),
9
+ one simulation job exported into a temporary folder, and whether ``ansysedt`` is found.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ import contextlib
15
+ import importlib
16
+ import importlib.metadata as md
17
+ import json
18
+ import os
19
+ import shutil
20
+ import sys
21
+ import tempfile
22
+ import time
23
+ from collections.abc import Callable
24
+ from dataclasses import dataclass
25
+ from pathlib import Path
26
+
27
+ DESIGN_RESOURCE = Path(__file__).parent / "data" / "selftest_q1_r1.json"
28
+
29
+ # group -> [(label, import name, distribution name)]
30
+ IMPORTS: dict[str, list[tuple[str, str, str]]] = {
31
+ "core": [
32
+ ("klayout", "klayout.db", "klayout"),
33
+ ("kqcircuits", "kqcircuits", "kqcircuits"),
34
+ ("numpy", "numpy", "numpy"),
35
+ ("scipy", "scipy", "scipy"),
36
+ ("networkx", "networkx", "networkx"),
37
+ ("pydantic", "pydantic", "pydantic"),
38
+ ("typer", "typer", "typer"),
39
+ ],
40
+ "analysis": [
41
+ ("quantum-metal", "qiskit_metal", "quantum-metal"),
42
+ ("pyEPR", "pyEPR", "pyEPR-quantum"),
43
+ ("scqubits", "scqubits", "scqubits"),
44
+ ("qutip", "qutip", "qutip"),
45
+ ("SQcircuit", "SQcircuit", "SQcircuit"),
46
+ ("qucat", "qucat", "qucat"),
47
+ ],
48
+ "sim": [
49
+ ("gmsh", "gmsh", "gmsh"),
50
+ ("pyaedt", "ansys.aedt.core", "pyaedt"),
51
+ ("scikit-rf", "skrf", "scikit-rf"),
52
+ ],
53
+ "notebook": [
54
+ ("ipykernel", "ipykernel", "ipykernel"),
55
+ ("nbclient", "nbclient", "nbclient"),
56
+ ("matplotlib", "matplotlib", "matplotlib"),
57
+ ],
58
+ }
59
+ OPTIONAL = [("torch", "torch", "torch")] # surrogates only: reported, never a failure
60
+
61
+ OK, FAIL, SKIP = "ok", "FAIL", "skip"
62
+
63
+
64
+ @dataclass
65
+ class Check:
66
+ name: str
67
+ status: str
68
+ detail: str = ""
69
+ seconds: float = 0.0
70
+
71
+ def line(self) -> str:
72
+ tail = f" ({self.seconds:.1f} s)" if self.seconds >= 0.5 else ""
73
+ return f"[{self.status:>4}] {self.name:<30} {self.detail}{tail}".rstrip()
74
+
75
+
76
+ def _version(dist: str, module) -> str:
77
+ try:
78
+ return md.version(dist)
79
+ except md.PackageNotFoundError:
80
+ return str(getattr(module, "__version__", "?"))
81
+
82
+
83
+ def _import_check(label: str, mod: str, dist: str, required: bool) -> Check:
84
+ t0 = time.time()
85
+ try:
86
+ module = importlib.import_module(mod)
87
+ except Exception as exc: # a broken install can raise anything (DLL load, version clash)
88
+ status = FAIL if required else SKIP
89
+ return Check(f"import {label}", status, f"{type(exc).__name__}: {exc}"[:200], time.time() - t0)
90
+ return Check(f"import {label}", OK, _version(dist, module), time.time() - t0)
91
+
92
+
93
+ def find_ansysedt() -> tuple[str, str]:
94
+ """(status, detail): whether ``ansysedt`` is found. Looks for the file only; AEDT is never started."""
95
+ try:
96
+ from quantcore_circuits.sim_tools.ansys import aedt_version, find_ansys_executable
97
+
98
+ exe = find_ansys_executable()
99
+ except Exception as exc:
100
+ return SKIP, f"lookup failed: {type(exc).__name__}: {exc}"
101
+ if exe is None:
102
+ return SKIP, "not found (fine for layout / LOM; install AEDT 2024 R1+ or set QCC_ANSYS_EXECUTABLE to solve)"
103
+ if not Path(exe).is_file():
104
+ return SKIP, f"QCC_ANSYS_EXECUTABLE points to a missing file: {exe}"
105
+ return OK, f"{exe} (v{aedt_version(exe)})"
106
+
107
+
108
+ def _step(name: str, fn: Callable[[], str]) -> Check:
109
+ t0 = time.time()
110
+ try:
111
+ return Check(name, OK, fn() or "", time.time() - t0)
112
+ except Exception as exc:
113
+ return Check(name, FAIL, f"{type(exc).__name__}: {exc}"[:300], time.time() - t0)
114
+
115
+
116
+ def run_checks(allow_missing: bool = False, emit: Callable[[Check], None] | None = None) -> list[Check]:
117
+ """Run all checks in order; ``emit`` is called with each as it finishes."""
118
+ results: list[Check] = []
119
+
120
+ def add(c: Check) -> Check:
121
+ results.append(c)
122
+ if emit:
123
+ emit(c)
124
+ return c
125
+
126
+ add(Check("python", OK if sys.version_info >= (3, 11) else FAIL, f"{sys.version.split()[0]} ({sys.platform})"))
127
+ with contextlib.suppress(Exception):
128
+ from quantcore_circuits import __version__
129
+
130
+ add(Check("quantcore-circuits", OK, __version__))
131
+ groups_ok: dict[str, bool] = {}
132
+ for group, items in IMPORTS.items():
133
+ res = [add(_import_check(*item, required=(group == "core" or not allow_missing))) for item in items]
134
+ groups_ok[group] = all(r.status == OK for r in res)
135
+ for item in OPTIONAL:
136
+ add(_import_check(*item, required=False))
137
+
138
+ if not groups_ok["core"]:
139
+ add(Check("chip checks", SKIP, "core imports failed"))
140
+ add(Check("ansysedt", *find_ansysedt()))
141
+ return results
142
+
143
+ tmp = Path(tempfile.mkdtemp(prefix="qcc_selftest_"))
144
+ cwd = os.getcwd()
145
+ state: dict = {}
146
+ try:
147
+ os.chdir(tmp)
148
+ design = tmp / "selftest_q1_r1.json"
149
+ if not DESIGN_RESOURCE.is_file():
150
+ add(Check("design file", FAIL, f"missing package data {DESIGN_RESOURCE}"))
151
+ return results
152
+ shutil.copy2(DESIGN_RESOURCE, design)
153
+ add(Check("design file", OK, "Q1 + R1 chip, package data"))
154
+
155
+ def build() -> str:
156
+ from quantcore_circuits.assembly import build as build_design
157
+
158
+ state["built"] = build_design(design)
159
+ return f"{design.stem} built"
160
+
161
+ def drc() -> str:
162
+ from quantcore_circuits.assembly.drc import check
163
+
164
+ report = check(design, netlist=True)
165
+ if not report.ok:
166
+ why = "; ".join(str(i.message) for i in report.errors[:2])
167
+ raise RuntimeError(f"{len(report.errors)} DRC error(s): {why}")
168
+ return f"clean, {len(report.warnings)} warning(s)"
169
+
170
+ def netlist() -> str:
171
+ from quantcore_circuits.circuit.derive import circuit_from_design
172
+
173
+ model = circuit_from_design(design, "chip")
174
+ state["model"] = model
175
+ return f"{len(model.nodes)} nodes, {len(model.branches)} branches"
176
+
177
+ def lom() -> str:
178
+ from quantcore_circuits.circuit.fill import fill
179
+ from quantcore_circuits.lom.simulate import simulate
180
+
181
+ res = simulate(fill(state["model"], design))
182
+ if not res.modes:
183
+ raise RuntimeError("no modes")
184
+ return ", ".join(f"{m.label} {m.f_GHz:.3f} GHz" for m in res.modes[:3])
185
+
186
+ def job() -> str:
187
+ from quantcore_circuits.sim_tools import build_simulation, export_job
188
+
189
+ out = tmp / "job"
190
+ export_job(build_simulation(design, "Q1R1", "q3d_cmatrix"), out, overwrite=True)
191
+ files = [p for p in out.rglob("*") if p.is_file()]
192
+ if not files:
193
+ raise RuntimeError("the job folder is empty")
194
+ return f"{len(files)} files, no solver started"
195
+
196
+ add(_step("build Q1 + R1 chip", build))
197
+ if results[-1].status == OK:
198
+ add(_step("DRC", drc))
199
+ add(_step("LOM netlist", netlist))
200
+ if results[-1].status != OK:
201
+ add(Check("LOM simulation", SKIP, "no netlist"))
202
+ elif not groups_ok["analysis"]:
203
+ add(Check("LOM simulation", SKIP, "needs the analysis extra"))
204
+ else:
205
+ add(_step("LOM simulation", lom))
206
+ add(_step("export sim job (q3d_cmatrix)", job))
207
+ else:
208
+ add(Check("DRC / LOM / job", SKIP, "the build failed"))
209
+ finally:
210
+ os.chdir(cwd)
211
+ shutil.rmtree(tmp, ignore_errors=True)
212
+ add(Check("ansysedt", *find_ansysedt()))
213
+ return results
214
+
215
+
216
+ def main(allow_missing: bool = False, as_json: bool = False) -> int:
217
+ results = run_checks(allow_missing, emit=None if as_json else lambda c: print(c.line(), flush=True))
218
+ failed = [c for c in results if c.status == FAIL]
219
+ if as_json:
220
+ print(json.dumps([c.__dict__ for c in results], indent=1))
221
+ else:
222
+ summary = f"selftest: {len(results) - len(failed)} of {len(results)} checks ok"
223
+ print(summary + (f", {len(failed)} FAILED" if failed else ""))
224
+ return 1 if failed else 0
@@ -0,0 +1,6 @@
1
+ """Simulation tools: sim-group builder, job export (HFSS/Q3D, Elmer, Palace), local/server runners, result parsers."""
2
+
3
+ from quantcore_circuits.sim_tools.builder import ALL_ANALYSES, SimPortInfo, SimSetup, build_simulation
4
+ from quantcore_circuits.sim_tools.export import export_job, read_job
5
+
6
+ __all__ = ["ALL_ANALYSES", "SimPortInfo", "SimSetup", "build_simulation", "export_job", "read_job"]
@@ -0,0 +1,66 @@
1
+ """Helper process for ``aedt="attach"``: run one qcc AEDT script inside an AEDT session that is already open.
2
+
3
+ Run by path (``python -I aedt_attach.py attach --port P --pid N --plugin DIR --script S --arg A --project NAME``),
4
+ standard library only, so it starts in a moment and a crash here never touches the notebook kernel. It connects with
5
+ AEDT's own gRPC client (``<AEDT>/PythonFiles/DesktopPlugin/PyDesktopPlugin.py``, shipped with AEDT 2024 R1), checks
6
+ that the port belongs to the expected AEDT process, closes an earlier copy of *this job's* project if one is open (it
7
+ would block the save), calls ``oDesktop.RunScriptWithArguments(script, arg)`` (blocks until the script returns) and
8
+ then only releases the connection. It never calls ``QuitApplication`` / ``ScriptEnv.Shutdown``: the session and all
9
+ its projects stay open. ``probe`` only connects and lists the open projects.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ import argparse
15
+ import sys
16
+ import time
17
+
18
+
19
+ def main(argv: list[str]) -> int:
20
+ ap = argparse.ArgumentParser(prog="qcc-aedt-attach")
21
+ ap.add_argument("cmd", choices=["attach", "probe"])
22
+ ap.add_argument("--port", type=int, required=True)
23
+ ap.add_argument("--pid", type=int, default=0)
24
+ ap.add_argument("--plugin", required=True)
25
+ ap.add_argument("--script", default="")
26
+ ap.add_argument("--arg", default="")
27
+ ap.add_argument("--project", default="")
28
+ a = ap.parse_args(argv)
29
+
30
+ def say(msg):
31
+ print(f"[qcc attach] {msg}", flush=True)
32
+
33
+ sys.path.insert(0, a.plugin)
34
+ try:
35
+ import PyDesktopPlugin # noqa: PLC0415 (AEDT's gRPC client)
36
+ except Exception as e: # noqa: BLE001
37
+ say(f"cannot load AEDT's PyDesktopPlugin from {a.plugin}: {type(e).__name__}: {e}")
38
+ return 4
39
+ try:
40
+ app = PyDesktopPlugin.CreateAedtApplication("", a.port, False, False) # connect; never a new session
41
+ desk = app.GetAppDesktop()
42
+ pid = int(desk.GetProcessID())
43
+ projects = [str(p) for p in desk.GetProjectList()]
44
+ say(f"connected to AEDT {desk.GetVersion()} pid {pid} on port {a.port}; open projects {projects}")
45
+ if a.pid and pid != a.pid:
46
+ say(f"port {a.port} belongs to pid {pid}, not {a.pid}: nothing run")
47
+ return 3
48
+ if a.cmd == "probe":
49
+ return 0
50
+ if a.project and a.project in projects:
51
+ desk.CloseProject(a.project)
52
+ say(f"closed the earlier copy of {a.project} (this job's own project; it is re-run now)")
53
+ say(f"running {a.script} {a.arg}")
54
+ t0 = time.time()
55
+ desk.RunScriptWithArguments(a.script, a.arg)
56
+ say(f"script returned after {time.time() - t0:.1f} s; the session and its projects stay open")
57
+ return 0
58
+ except Exception as e: # noqa: BLE001
59
+ say(f"{type(e).__name__}: {e}")
60
+ return 2
61
+ finally:
62
+ PyDesktopPlugin.Release() # drops this connection only
63
+
64
+
65
+ if __name__ == "__main__":
66
+ sys.exit(main(sys.argv[1:]))