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,224 @@
1
+ """Live progress of an AEDT render / solve, read from the job directory while it runs (any AEDT mode).
2
+
3
+ AEDT in batch mode prints nothing to its log, so a stuck run and a slow one look the same. This reads what AEDT and
4
+ the qcc script write as they go:
5
+
6
+ * ``qcc_<mode>_status.txt`` (:mod:`.aedt_scripts`): the current step (``import``, ``solve``, ``export``, ``epr``);
7
+ * ``<project>.aedtresults/<Design>.results/*.EMConvData`` (HFSS eigenmode / driven): one block per adaptive pass with
8
+ the solved tetrahedra and ``MaxDeltaFreq`` (%) or ``MaxMagDeltaS``, the target and the pass limit;
9
+ * ``*_SOL*_M<n>_V*.sd`` (eigenmode): the mode frequencies of pass ``n``;
10
+ * ``*_SOL*_MCAP<n>_V*.sd`` (Q3D): the capacitance matrix of pass ``n``; ΔC is the largest relative change of a
11
+ diagonal entry from the previous pass (an estimate of Q3D's own % error);
12
+ * ``*/current.stats``: the current mesh size (``NumTotalTets`` / ``NumTotalTris``).
13
+
14
+ :func:`read_progress` returns a dict, :func:`format_progress` one line for the notebook (printed every ~30 s by
15
+ :func:`quantcore_circuits.sim_tools.hfss.solve_job`).
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ import json
21
+ import re
22
+ import time
23
+ from pathlib import Path
24
+
25
+ __all__ = ["format_progress", "parse_em_conv", "read_progress"]
26
+
27
+ _PASS_RE = re.compile(r"PassNo=(\d+)")
28
+ _VAL_RE = re.compile(r"(\w+)\(([-+0-9.eE]+),")
29
+
30
+
31
+ def parse_em_conv(text: str) -> dict:
32
+ """An HFSS ``.EMConvData`` file → ``{"passes": [{"pass", "elements", "delta"}], "criterion", "target",
33
+ "max_passes", "converged"}`` (``delta`` in % for ΔF, absolute for ΔS; frequency-point repeats are merged)."""
34
+ info = {}
35
+ for key in ("IsConverged", "MaxPasses", "MinPasses", "ConvTarget"):
36
+ m = re.search(rf"{key}='?([^'\n]+)'?", text)
37
+ if m:
38
+ info[key] = m.group(1).strip()
39
+ passes: dict[int, dict] = {}
40
+ criterion = None
41
+ for block in text.split("$begin 'QuantityValues'")[1:]:
42
+ m = _PASS_RE.search(block)
43
+ if not m:
44
+ continue
45
+ n = int(m.group(1))
46
+ rec = passes.setdefault(n, {"pass": n, "elements": None, "delta": None})
47
+ for name, value in _VAL_RE.findall(block):
48
+ if name == "SolvedElements":
49
+ rec["elements"] = int(float(value))
50
+ elif name.startswith("Max") and "Delta" in name:
51
+ criterion = {"MaxDeltaFreq": "ΔF", "MaxMagDeltaS": "ΔS"}.get(name, name)
52
+ rec["delta"] = float(value) if rec["delta"] is None else max(rec["delta"], float(value))
53
+ target = info.get("ConvTarget")
54
+ return {
55
+ "passes": [passes[k] for k in sorted(passes)],
56
+ "criterion": criterion,
57
+ "target": float(target) if target else None,
58
+ "max_passes": int(info["MaxPasses"]) if info.get("MaxPasses", "").isdigit() else None,
59
+ "converged": info.get("IsConverged", "").lower() == "true",
60
+ }
61
+
62
+
63
+ def _newest(paths):
64
+ paths = [p for p in paths if p.is_file()]
65
+ return max(paths, key=lambda p: p.stat().st_mtime) if paths else None
66
+
67
+
68
+ def _mesh_size(results: Path) -> tuple[int | None, str | None]:
69
+ stats = _newest(results.glob("*/current.stats"))
70
+ if stats is None:
71
+ return None, None
72
+ text = stats.read_text(encoding="utf-8", errors="replace")
73
+ for key, unit in (("NumTotalTets", "tets"), ("NumTotalTris", "triangles")):
74
+ m = re.search(rf"{key}\s+(\d+)", text)
75
+ if m:
76
+ return int(m.group(1)), unit
77
+ return None, None
78
+
79
+
80
+ def _eigen_modes(results: Path) -> tuple[int | None, list[float]]:
81
+ """(pass, mode frequencies in GHz) of the newest per-pass eigenmode solution file."""
82
+ best = None
83
+ for p in results.glob("*_M*_V*.sd"):
84
+ m = re.search(r"_M(\d+)_V\d+\.sd$", p.name)
85
+ if p.is_file() and m and int(m.group(1)) > 0 and (best is None or int(m.group(1)) > best[0]):
86
+ best = (int(m.group(1)), p)
87
+ if best is None:
88
+ return None, []
89
+ text = best[1].read_text(encoding="utf-8", errors="replace")
90
+ m = re.search(r"\bModes\(([^)]*)\)", text) if "SolveMaxModes" in text else None # eigenmode solutions only
91
+ vals = [float(x) for x in m.group(1).split(",") if x.strip()] if m else []
92
+ return best[0], [vals[i] / 1e9 for i in range(0, len(vals), 2)]
93
+
94
+
95
+ def _diag(text: str) -> list[float]:
96
+ out = []
97
+ for i, row in enumerate(re.findall(r"\$begin 'r\d+'(.*?)\$end", text, re.S)):
98
+ vals = re.findall(r"c\(([-+0-9.eE]+)\)", row)
99
+ if i < len(vals):
100
+ out.append(float(vals[i]))
101
+ return out
102
+
103
+
104
+ def _q3d_passes(results: Path) -> list[dict]:
105
+ """Per adaptive Q3D pass: the diagonal of its C matrix and ΔC (%) from the previous pass."""
106
+ files = {}
107
+ for p in results.glob("*_MCAP*_V*.sd"):
108
+ m = re.search(r"_MCAP(\d+)_V\d+\.sd$", p.name)
109
+ if p.is_file() and m and int(m.group(1)) > 0:
110
+ files[int(m.group(1))] = p
111
+ out, prev = [], None
112
+ for n in sorted(files):
113
+ diag = _diag(files[n].read_text(encoding="utf-8", errors="replace"))
114
+ delta = None
115
+ if prev and len(prev) == len(diag) and all(diag):
116
+ delta = 100 * max(abs(a - b) / abs(a) for a, b in zip(diag, prev))
117
+ out.append({"pass": n, "delta": delta, "C_fF": [c * 1e15 for c in diag]})
118
+ prev = diag
119
+ return out
120
+
121
+
122
+ def _status(job_dir: Path, mode: str) -> list[str]:
123
+ p = job_dir / f"qcc_{mode}_status.txt"
124
+ return p.read_text(encoding="utf-8", errors="replace").splitlines() if p.exists() else []
125
+
126
+
127
+ def read_progress(job_dir: str | Path, mode: str = "solve") -> dict:
128
+ """What a running (or finished) AEDT job has done so far; see the module docstring. Missing files → ``None``."""
129
+ job_dir = Path(job_dir)
130
+ status = _status(job_dir, mode)
131
+ steps = [s[5:] for s in status if s.startswith("step ")]
132
+ out: dict = {
133
+ "step": steps[-1] if steps else None,
134
+ "finished": any(s in ("done", "error", "end") for s in status),
135
+ "failed": any(s == "error" for s in status),
136
+ "status_tail": status[-1] if status else None,
137
+ "pass": None,
138
+ "max_passes": None,
139
+ "criterion": None,
140
+ "delta": None,
141
+ "target": None,
142
+ "elements": None,
143
+ "element_unit": None,
144
+ "converged": None,
145
+ "modes_GHz": [],
146
+ "last_write": None,
147
+ }
148
+ try:
149
+ job = json.loads((job_dir / "job.json").read_text(encoding="utf-8"))
150
+ except (OSError, ValueError):
151
+ job = {}
152
+ settings = job.get("settings") or {}
153
+ results = sorted(job_dir.glob("*_project.aedtresults/*.results"))
154
+ if not results:
155
+ return out
156
+ res = results[0]
157
+ stamps = [p.stat().st_mtime for p in res.iterdir()] if res.is_dir() else []
158
+ out["last_write"] = max(stamps) if stamps else None
159
+ out["elements"], out["element_unit"] = _mesh_size(res)
160
+ conv = _newest(res.glob("*.EMConvData"))
161
+ if conv is not None:
162
+ c = parse_em_conv(conv.read_text(encoding="utf-8", errors="replace"))
163
+ last = c["passes"][-1] if c["passes"] else {}
164
+ delta = next((p["delta"] for p in reversed(c["passes"]) if p["delta"] is not None), None)
165
+ out.update(criterion=c["criterion"], target=c["target"], max_passes=c["max_passes"],
166
+ converged=c["converged"], delta=delta)
167
+ out["pass"] = last.get("pass")
168
+ if last.get("elements"):
169
+ out["elements"], out["element_unit"] = last["elements"], "tets"
170
+ passes = _q3d_passes(res)
171
+ if passes:
172
+ out["pass"], out["criterion"] = passes[-1]["pass"], "ΔC"
173
+ out["delta"] = next((p["delta"] for p in reversed(passes) if p["delta"] is not None), None)
174
+ out["target"] = settings.get("percent_error")
175
+ out["max_passes"] = settings.get("maximum_passes")
176
+ n, modes = _eigen_modes(res)
177
+ if modes:
178
+ out["modes_GHz"] = modes
179
+ out["pass"] = max(out["pass"] or 0, n)
180
+ if out["max_passes"] is None:
181
+ out["max_passes"] = settings.get("maximum_passes")
182
+ return out
183
+
184
+
185
+ def _fmt_elapsed(seconds: float) -> str:
186
+ s = int(seconds)
187
+ return f"{s // 3600}:{s // 60 % 60:02d}:{s % 60:02d}" if s >= 3600 else f"{s // 60}:{s % 60:02d}"
188
+
189
+
190
+ def echo(text: str) -> None:
191
+ """``print`` a progress line, flushed; on a console that cannot encode it (Windows cp1252: Δ, →, µ) the
192
+ unencodable characters become ``?`` instead of raising (a script solve died on its first progress line)."""
193
+ import sys # pylint: disable=import-outside-toplevel
194
+
195
+ try:
196
+ print(text, flush=True)
197
+ except UnicodeEncodeError:
198
+ enc = getattr(sys.stdout, "encoding", None) or "ascii"
199
+ print(text.encode(enc, errors="replace").decode(enc, errors="replace"), flush=True)
200
+
201
+
202
+ def format_progress(p: dict, elapsed: float | None = None, label: str = "", now: float | None = None) -> str:
203
+ """One status line: ``[aedt 4:30 batch pid 1234] solve · pass 7/14 · 65 324 tets · ΔF 8.09 % (target 0.2 %)``."""
204
+ head = " ".join(x for x in ("aedt", _fmt_elapsed(elapsed) if elapsed is not None else "", label) if x)
205
+ parts = [p.get("step") or "starting"]
206
+ if p.get("pass"):
207
+ parts.append(f"pass {p['pass']}" + (f"/{p['max_passes']}" if p.get("max_passes") else ""))
208
+ if p.get("elements"):
209
+ parts.append(f"{p['elements']:,} {p.get('element_unit') or 'elements'}".replace(",", " "))
210
+ if p.get("criterion") and p.get("delta") is not None:
211
+ unit = "" if p["criterion"] == "ΔS" else " %"
212
+ tgt = f" (target {p['target']:g}{unit})" if p.get("target") is not None else ""
213
+ parts.append(f"{p['criterion']} {p['delta']:.3g}{unit}{tgt}")
214
+ if p.get("converged"):
215
+ parts.append("converged")
216
+ if p.get("modes_GHz"):
217
+ parts.append("f " + ", ".join(f"{f:.4f}" for f in p["modes_GHz"][:6]) + " GHz")
218
+ if p.get("finished"):
219
+ parts.append("FAILED" if p.get("failed") else "finished")
220
+ elif p.get("last_write") and p.get("step") == "solve":
221
+ idle = (now or time.time()) - p["last_write"]
222
+ if idle > 300:
223
+ parts.append(f"no solver output for {_fmt_elapsed(idle)} (meshing / a large pass, or stuck)")
224
+ return f"[{head}] " + " · ".join(parts)
@@ -0,0 +1,302 @@
1
+ """Read an AEDT project file (``.aedt``) without AEDT: designs, materials, parts, boundaries, nets, setups, sweeps.
2
+
3
+ The ``.aedt`` format is a tree of ``$begin 'Name'`` … ``$end 'Name'`` blocks holding ``Key=Value`` lines and
4
+ ``Name(args)`` calls (e.g. ``Objects(6, 84)``, ``VariableProp('Lj_1', 'UD', '', '1.2e-08H')``). :func:`parse_aedt`
5
+ builds that tree; :func:`project_info` extracts what a qcc render must contain; :func:`check_settings` compares a
6
+ job's solver settings (``job.json`` ``settings``) with the setup that landed in the project.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import re
12
+ from dataclasses import dataclass, field
13
+ from pathlib import Path
14
+
15
+ _BEGIN = re.compile(r"^\s*\$begin '(.*)'\s*$")
16
+ _END = re.compile(r"^\s*\$end '(.*)'\s*$")
17
+ _CALL = re.compile(r"^\s*([A-Za-z_][\w ]*)\((.*)\)\s*$")
18
+ _KV = re.compile(r"^\s*('[^']*'|[^=\s'(\[]+)=(.*)$")
19
+ _NUM = re.compile(r"^[-+]?(\d+\.?\d*|\.\d+)([eE][-+]?\d+)?$")
20
+
21
+
22
+ @dataclass
23
+ class Block:
24
+ name: str
25
+ attrs: dict = field(default_factory=dict)
26
+ calls: list = field(default_factory=list) # (name, raw args)
27
+ children: list = field(default_factory=list)
28
+
29
+ def child(self, name: str) -> Block | None:
30
+ return next((c for c in self.children if c.name == name), None)
31
+
32
+ def find(self, name: str) -> Block | None:
33
+ """First descendant block called ``name`` (depth first)."""
34
+ for c in self.children:
35
+ if c.name == name:
36
+ return c
37
+ hit = c.find(name)
38
+ if hit is not None:
39
+ return hit
40
+ return None
41
+
42
+ def find_all(self, name: str) -> list[Block]:
43
+ out = []
44
+ for c in self.children:
45
+ if c.name == name:
46
+ out.append(c)
47
+ out += c.find_all(name)
48
+ return out
49
+
50
+ def flat(self, prefix: str = "") -> dict:
51
+ """attrs of this block and its children as ``{"Child.Key": value}`` (one dict, nested names joined)."""
52
+ out = {prefix + k: v for k, v in self.attrs.items()}
53
+ for c in self.children:
54
+ out.update(c.flat(f"{prefix}{c.name}."))
55
+ return out
56
+
57
+
58
+ def _value(raw: str):
59
+ s = raw.strip()
60
+ if len(s) >= 2 and s[0] == s[-1] == "'":
61
+ return s[1:-1]
62
+ if s in ("true", "false"):
63
+ return s == "true"
64
+ if _NUM.match(s):
65
+ return float(s) if any(c in s for c in ".eE") else int(s)
66
+ return s
67
+
68
+
69
+ def parse_aedt(source) -> Block:
70
+ """Parse an ``.aedt`` file (path) or its text into a :class:`Block` tree (root name ``""``)."""
71
+ text = source if isinstance(source, str) and "\n" in source else Path(source).read_text("utf-8", "replace")
72
+ root = Block("")
73
+ stack = [root]
74
+ for line in text.splitlines():
75
+ m = _BEGIN.match(line)
76
+ if m:
77
+ b = Block(m.group(1))
78
+ stack[-1].children.append(b)
79
+ stack.append(b)
80
+ continue
81
+ m = _END.match(line)
82
+ if m:
83
+ if len(stack) > 1:
84
+ stack.pop()
85
+ continue
86
+ m = _CALL.match(line)
87
+ if m and "=" not in line.split("(", 1)[0]:
88
+ stack[-1].calls.append((m.group(1), m.group(2)))
89
+ continue
90
+ m = _KV.match(line)
91
+ if m:
92
+ key = m.group(1).strip("'")
93
+ stack[-1].attrs[key] = _value(m.group(2))
94
+ return root
95
+
96
+
97
+ def _num(v):
98
+ try:
99
+ return float(v)
100
+ except (TypeError, ValueError):
101
+ return v
102
+
103
+
104
+ def _ints(raw: str) -> list[int]:
105
+ return [int(x) for x in re.findall(r"-?\d+", raw)]
106
+
107
+
108
+ def _quoted(raw: str) -> list[str]:
109
+ return re.findall(r"'([^']*)'", raw)
110
+
111
+
112
+ DESIGN_BLOCKS = {"HFSSModel": "HFSS", "Q3DModel": "Q3D Extractor", "2DExtractorModel": "2D Extractor"}
113
+
114
+
115
+ def _parts(design: Block) -> dict[int, dict]:
116
+ parts: dict[int, dict] = {}
117
+ top = design.find("ToplevelParts")
118
+ for gp in top.children if top else []:
119
+ if gp.name != "GeometryPart":
120
+ continue
121
+ attrs = gp.child("Attributes").attrs if gp.child("Attributes") else {}
122
+ ops = gp.child("Operations")
123
+ first = next((o for o in (ops.children if ops else []) if o.name == "Operation"), None)
124
+ if first is None:
125
+ continue
126
+ pid = first.attrs.get("ParentPartID")
127
+ info = {
128
+ "name": attrs.get("Name"),
129
+ "material": str(attrs.get("MaterialValue", "")).strip('"'),
130
+ "solve_inside": attrs.get("SolveInside"),
131
+ "operation": first.attrs.get("OperationType"),
132
+ }
133
+ box = first.child("BoxParameters")
134
+ if box is not None:
135
+ info["box"] = {k: box.attrs[k] for k in ("XPosition", "YPosition", "ZPosition", "XSize", "YSize", "ZSize")}
136
+ parts[int(pid)] = info
137
+ return parts
138
+
139
+
140
+ def _design_info(design: Block) -> dict:
141
+ parts = _parts(design)
142
+ names = {pid: p["name"] for pid, p in parts.items()}
143
+ variables = {}
144
+ props = design.find("Properties")
145
+ for name, raw in props.calls if props else []:
146
+ if name == "VariableProp":
147
+ q = _quoted(raw)
148
+ if q:
149
+ variables[q[0]] = q[-1]
150
+ bounds = {}
151
+ bset = design.find("BoundarySetup")
152
+ bblock = bset.child("Boundaries") if bset else None
153
+ for b in bblock.children if bblock else []:
154
+ objs = next((_ints(raw) for n, raw in b.calls if n == "Objects"), [])
155
+ entry = {k: v for k, v in b.attrs.items() if k not in ("ID", "IsComponent", "ParentBndID")}
156
+ entry["objects"] = [names.get(o, o) for o in objs]
157
+ terminals = b.find("Terminals") or b.child("Terminals")
158
+ if terminals is not None:
159
+ entry["terminals"] = [t.name for t in terminals.children]
160
+ bounds[b.name] = entry
161
+ setups = {}
162
+ solve = design.find("SolveSetups")
163
+ for s in solve.children if solve else []:
164
+ flat = s.flat()
165
+ sweeps = {}
166
+ for sw in s.find_all("Sweeps"):
167
+ for x in sw.children:
168
+ sweeps[x.name] = x.flat()
169
+ setups[s.name] = {"settings": flat, "sweeps": sweeps}
170
+ mesh_ops = {}
171
+ mops = design.find("MeshOperations")
172
+ for op in mops.children if mops else []:
173
+ objs = next((_ints(raw) for n, raw in op.calls if n == "Objects"), [])
174
+ mesh_ops[op.name] = {**op.attrs, "objects": [names.get(o, o) for o in objs]}
175
+ out = {
176
+ "name": design.attrs.get("Name"),
177
+ "solution_type": design.attrs.get("SolutionType"),
178
+ "variables": variables,
179
+ "parts": list(parts.values()),
180
+ "boundaries": bounds,
181
+ "setups": setups,
182
+ "mesh_operations": mesh_ops,
183
+ }
184
+ # Q3D: signal nets → the KQC excitation numbers of their objects (layer "1t1_signal_<n>", object "<layer>_<k>")
185
+ nets = {}
186
+ for bname, b in bounds.items():
187
+ if b.get("BoundType") in ("SignalNet", "GroundNet", "FloatingNet"):
188
+ exc = sorted({int(m.group(1)) for o in b["objects"] if (m := re.search(r"signal_(\d+)_\d+$", str(o)))})
189
+ nets[bname] = {"type": b["BoundType"], "objects": b["objects"], "excitations": exc}
190
+ out["nets"] = nets
191
+ return out
192
+
193
+
194
+ def project_info(project) -> dict:
195
+ """Designs (type, name, solution type, variables, parts, boundaries, nets, setups/sweeps) and materials."""
196
+ root = parse_aedt(project)
197
+ proj = root.child("AnsoftProject") or root
198
+ mats = {}
199
+ defs = proj.child("Definitions")
200
+ mblock = defs.child("Materials") if defs else None
201
+ for m in mblock.children if mblock else []:
202
+ keys = ("permittivity", "dielectric_loss_tangent", "conductivity")
203
+ mats[m.name] = {k: _num(m.attrs[k]) for k in keys if k in m.attrs}
204
+ designs = []
205
+ for b in proj.children:
206
+ if b.name in DESIGN_BLOCKS:
207
+ designs.append({"design_type": DESIGN_BLOCKS[b.name], **_design_info(b)})
208
+ return {"materials": mats, "designs": designs}
209
+
210
+
211
+ def _ghz(v):
212
+ if isinstance(v, (int, float)):
213
+ return float(v)
214
+ m = re.match(r"^\s*([-+0-9.eE]+)\s*([a-zA-Z]*)", str(v))
215
+ if not m:
216
+ return None
217
+ scale = {"": 1.0, "ghz": 1.0, "mhz": 1e-3, "khz": 1e-6, "hz": 1e-9}.get(m.group(2).lower())
218
+ return float(m.group(1)) * scale if scale is not None else None
219
+
220
+
221
+ # job.json setting → (path in the AEDT setup's flattened attrs, kind); "sweep:" paths are read from the first sweep
222
+ SETTING_KEYS = {
223
+ "q3d_cmatrix": {
224
+ "percent_error": ("Cap.PerError", "num"),
225
+ "maximum_passes": ("Cap.MaxPass", "num"),
226
+ "minimum_passes": ("Cap.MinPass", "num"),
227
+ "minimum_converged_passes": ("Cap.MinConvPass", "num"),
228
+ "percent_refinement": ("Cap.PerRefine", "num"),
229
+ "frequency": ("AdaptiveFreq", "ghz"),
230
+ },
231
+ "hfss_eigenmode": {
232
+ "n_modes": ("NumModes", "num"),
233
+ "min_frequency": ("MinimumFrequency", "ghz"),
234
+ "max_delta_f": ("MaxDeltaFreq", "num"),
235
+ "maximum_passes": ("MaximumPasses", "num"),
236
+ "minimum_passes": ("MinimumPasses", "num"),
237
+ "minimum_converged_passes": ("MinimumConvergedPasses", "num"),
238
+ "percent_refinement": ("PercentRefinement", "num"),
239
+ "basis_order": ("BasisOrder", "num"),
240
+ },
241
+ "hfss_driven": {
242
+ "frequency": ("Frequency", "ghz"),
243
+ "max_delta_s": ("MaxDeltaS", "num"),
244
+ "maximum_passes": ("MaximumPasses", "num"),
245
+ "minimum_passes": ("MinimumPasses", "num"),
246
+ "minimum_converged_passes": ("MinimumConvergedPasses", "num"),
247
+ "percent_refinement": ("PercentRefinement", "num"),
248
+ "basis_order": ("BasisOrder", "num"),
249
+ "sweep_enabled": ("sweep:IsEnabled", "bool"),
250
+ "sweep_start": ("sweep:RangeStart", "ghz"),
251
+ "sweep_end": ("sweep:RangeEnd", "ghz"),
252
+ "sweep_count": ("sweep:RangeCount", "num"),
253
+ "sweep_type": ("sweep:Type", "str"),
254
+ },
255
+ }
256
+ SETTING_KEYS["eigenmode_epr"] = SETTING_KEYS["hfss_eigenmode"]
257
+ # settings that are not AEDT setup fields (handled elsewhere by KQC's import)
258
+ NOT_IN_SETUP = {"integrate_energies": "KQC adds energy-integral reports instead", "pyepr": "post-process options"}
259
+
260
+
261
+ def check_settings(project, analysis: str, settings: dict, setup: str = "Setup1") -> list[dict]:
262
+ """Rows ``{"key", "expected", "found", "ok", "where"}``: every job setting read back from the AEDT setup.
263
+
264
+ ``ok`` is None for a setting that is not an AEDT setup field (e.g. ``integrate_energies``)."""
265
+ info = project if isinstance(project, dict) else project_info(project)
266
+ design = info["designs"][0]
267
+ s = design["setups"].get(setup, {"settings": {}, "sweeps": {}})
268
+ sweep = next(iter(s["sweeps"].values()), {})
269
+ rows = []
270
+ for key, expected in settings.items():
271
+ if key == "mesh_size": # KQC: one length-based mesh operation "mesh_size_<layer pattern>" per entry
272
+ for layer, length in (expected or {}).items():
273
+ op = design.get("mesh_operations", {}).get(f"mesh_size_{layer}", {})
274
+ found = op.get("MaxLength")
275
+ ok = found is not None and abs(float(str(found).replace("um", "")) - float(length)) < 1e-9
276
+ ok = ok and bool(op.get("objects")) and op.get("Enabled", True) is not False
277
+ rows.append(
278
+ {
279
+ "key": f"mesh_size.{layer}",
280
+ "expected": length,
281
+ "found": found,
282
+ "ok": bool(ok),
283
+ "where": f"MeshOperations.mesh_size_{layer} ({len(op.get('objects', []))} objects)",
284
+ }
285
+ )
286
+ continue
287
+ spec = SETTING_KEYS.get(analysis, {}).get(key)
288
+ if spec is None:
289
+ rows.append({"key": key, "expected": expected, "found": None, "ok": None, "where": NOT_IN_SETUP.get(key)})
290
+ continue
291
+ where, kind = spec
292
+ found = sweep.get(where[6:]) if where.startswith("sweep:") else s["settings"].get(where)
293
+ if kind == "ghz":
294
+ ok = found is not None and abs(_ghz(found) - float(expected)) < 1e-9 * max(1.0, abs(float(expected)))
295
+ elif kind == "num":
296
+ ok = found is not None and abs(float(found) - float(expected)) < 1e-12 * max(1.0, abs(float(expected)))
297
+ elif kind == "bool":
298
+ ok = found is not None and bool(found) == bool(expected)
299
+ else:
300
+ ok = found is not None and str(found).lower() == str(expected).lower()
301
+ rows.append({"key": key, "expected": expected, "found": found, "ok": bool(ok), "where": f"{setup}.{where}"})
302
+ return rows