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,878 @@
1
+ """Parameter cards, chip elements and the process summary for the dashboard (``State.sections`` / ``cards`` /
2
+ ``summary`` / ``elements``).
3
+
4
+ Every number the loop produces gets a card: what it is, its value (chosen estimator / FEM / estimate), where it
5
+ comes from (dependency chips pointing at the card they come from), the target or design value, the estimator range
6
+ and the formula. Cards are organised by chip **element** so a chip with any number of qubits reads the same way:
7
+
8
+ * ``elements`` — one entry per qubit, readout resonator, bus, coupler, feedline and port, with its key parameters
9
+ (value / unit / status / target, the card that explains it) and its links (which resonator reads which qubit, which
10
+ feedline it hangs off, which pad biases it). The dashboard's chip overview table is built from this list.
11
+ * every card carries ``element`` (``"Q1"``, ``"R1"``, … or ``"chip"`` for process / simulation / jobs / feedback);
12
+ coupling cards also carry ``partner`` (element ``"Q1"``, partner ``"R1"``), so they show under that pair.
13
+
14
+ Works on LOM-only analyses (layout estimates, no FEM job) and on FEM-filled ones, for N transmon–resonator pairs.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ import math
20
+
21
+ CHIP = "chip"
22
+
23
+
24
+ def _fmt(v, unit=""):
25
+ if v is None:
26
+ return "–"
27
+ if isinstance(v, str):
28
+ return v
29
+ a = abs(v)
30
+ s = f"{v:.4g}" if a < 1e4 else f"{v:,.0f}"
31
+ return f"{s} {unit}".strip()
32
+
33
+
34
+ class _Cards:
35
+ def __init__(self):
36
+ self.cards: list[dict] = []
37
+ self.sections: list[dict] = []
38
+ self.n = 0
39
+ self.ids: set[str] = set()
40
+
41
+ def section(self, ident, letter, title, subtitle=""):
42
+ if ident not in {s["id"] for s in self.sections}:
43
+ self.sections.append({"id": ident, "letter": letter, "title": title, "subtitle": subtitle})
44
+
45
+ def card(self, section, element, title, symbol, value, unit, *, ident, partner=None, **kw) -> str:
46
+ """Add a card; returns its id (use it as a ``from`` reference)."""
47
+ self.n += 1
48
+ if ident in self.ids:
49
+ ident = f"{ident}#{self.n}"
50
+ self.ids.add(ident)
51
+ self.cards.append(
52
+ {
53
+ "id": ident,
54
+ "section": section,
55
+ "element": element,
56
+ **({"partner": partner} if partner else {}),
57
+ "index": self.n,
58
+ "title": title,
59
+ "symbol": symbol,
60
+ "value": None if value is None or not _isfinite(value) else float(value),
61
+ "unit": unit,
62
+ **{k: v for k, v in kw.items() if v is not None},
63
+ }
64
+ )
65
+ return ident
66
+
67
+
68
+ def _row(rows, param):
69
+ return next((r for r in rows if r.param == param), None)
70
+
71
+
72
+ def _range(r):
73
+ if r is None or not r.values:
74
+ return None
75
+ vs = [v for v in r.values.values() if v is not None]
76
+ return [min(vs), max(vs)] if len(vs) > 1 else None
77
+
78
+
79
+ def _target(r):
80
+ return {"value": r.target, "tol": r.tol} if r is not None and r.target is not None else None
81
+
82
+
83
+ def _status(r):
84
+ return (
85
+ r.status
86
+ if r is not None and r.status in ("pass", "fail")
87
+ else ("warn" if r is not None and r.flagged else None)
88
+ )
89
+
90
+
91
+ def _chosen(r):
92
+ return r.chosen if r is not None else None
93
+
94
+
95
+ def _param(key, label, symbol, value, unit, row=None, card=None, of=None, source=None, status=None) -> dict:
96
+ """One ``ElementParam``: a column of the chip overview table."""
97
+ out = {
98
+ "key": key,
99
+ "label": label,
100
+ "symbol": symbol,
101
+ "value": None if value is None or not _isfinite(value) else float(value),
102
+ "unit": unit,
103
+ }
104
+ if row is not None:
105
+ if row.target is not None:
106
+ out["target"] = {"value": row.target, "tol": row.tol}
107
+ status = status or _status(row)
108
+ source = source or row.chosen_by
109
+ if status:
110
+ out["status"] = status
111
+ if source:
112
+ out["source"] = source
113
+ if card:
114
+ out["card"] = card
115
+ if of:
116
+ out["of"] = of
117
+ return out
118
+
119
+
120
+ def _worst(params) -> str | None:
121
+ st = {p.get("status") for p in params}
122
+ return next((s for s in ("fail", "warn", "pass") if s in st), None)
123
+
124
+
125
+ class _Topology:
126
+ """Who is who in the circuit model: qubits, readout resonators, buses, couplers, feedlines, ports, flux lines."""
127
+
128
+ def __init__(self, design, model, plan):
129
+ self.model, self.design = model, design
130
+ gnd = model.ground
131
+ br = model.branches
132
+ self.qubit_junction: dict[str, str] = {}
133
+ for name, b in br.items():
134
+ if b.type in ("JJ", "SQUID"):
135
+ q = b.nodes[0] if b.nodes[1] == gnd else b.nodes[1]
136
+ self.qubit_junction.setdefault(q, name)
137
+ self.qubits = list(self.qubit_junction)
138
+ cap = [(n, b) for n, b in br.items() if b.type == "C"]
139
+
140
+ def qubits_at(node):
141
+ return [q for q in self.qubits if any(set(b.nodes) == {q, node} for _, b in cap)]
142
+
143
+ self.resonators: dict[str, dict] = {} # TLres name → {"node", "qubits", "feedline", "hanger", "kind"}
144
+ for name, b in br.items():
145
+ if b.type != "TLres":
146
+ continue
147
+ node = b.nodes[0] if b.nodes[1] == gnd else b.nodes[1]
148
+ hanger = next((h for h, x in br.items() if x.type == "HANGER" and node in x.nodes), None)
149
+ fl = None
150
+ if hanger:
151
+ hb = br[hanger].nodes
152
+ fl = hb[1] if hb[0] == node else hb[0]
153
+ qs = qubits_at(node)
154
+ kind = "bus" if len(qs) >= 2 else "resonator"
155
+ self.resonators[name] = {"node": node, "qubits": qs, "feedline": fl, "hanger": hanger, "kind": kind}
156
+ self.couplers = {
157
+ n: list(b.nodes) for n, b in cap if b.nodes[0] in self.qubits and b.nodes[1] in self.qubits
158
+ } # direct island–island capacitances
159
+ fls = [r["feedline"] for r in self.resonators.values() if r["feedline"]]
160
+ fls += [b.nodes[0] for n, b in br.items() if b.type == "R" and b.nodes[1] == gnd]
161
+ self.feedlines = [n for n in dict.fromkeys(fls) if n and n != gnd]
162
+ # ports: pads at the ends of feedline routes and of flux / control lines (from the design's routes)
163
+ self.ports: dict[str, dict] = {} # pad instance → {"role", "to", "line", "length_um"}
164
+ self.flux: dict[str, str] = {} # qubit → pad
165
+ for rname, route in design.routes.items():
166
+ ends = [e for e in (route.from_, route.to) if isinstance(e, str)]
167
+ insts = [e.split(".", 1) for e in ends]
168
+ length = plan.routes[rname].length if rname in plan.routes else None
169
+ if rname in self.feedlines:
170
+ for inst, _ in insts:
171
+ self.ports[inst] = {"role": "feedline", "to": rname, "line": rname, "length_um": length}
172
+ continue
173
+ qubit_end = next(((i, p) for i, p in insts if i in self.qubits and "flux" in p), None)
174
+ if qubit_end and len(insts) == 2:
175
+ pad = next(i for i, p in insts if (i, p) != qubit_end)
176
+ self.ports[pad] = {"role": "flux", "to": qubit_end[0], "line": rname, "length_um": length}
177
+ self.flux[qubit_end[0]] = pad
178
+ self.fl_ports = {
179
+ fl: [p for p, v in self.ports.items() if v["role"] == "feedline" and v["to"] == fl] for fl in self.feedlines
180
+ }
181
+ self.feedline_length = {fl: plan.routes[fl].length if fl in plan.routes else None for fl in self.feedlines}
182
+
183
+
184
+ def build(design, an, proposal=None, jobs=None) -> dict:
185
+ """``{"sections", "cards", "summary", "elements"}`` from an :class:`~quantcore_circuits.loop.Analysis`."""
186
+ from quantcore_circuits.analysis.synthesis import cpw_properties # pylint: disable=import-outside-toplevel
187
+ from quantcore_circuits.analysis.transmon import transmon_spectrum # pylint: disable=import-outside-toplevel
188
+ from quantcore_circuits.assembly import plan_design # pylint: disable=import-outside-toplevel
189
+ from quantcore_circuits.circuit.bridges import ic_from_lj, rn_from_ic, squid_ej # pylint: disable=C0415
190
+ from quantcore_circuits.circuit.fill import two_node_model # pylint: disable=import-outside-toplevel
191
+ from quantcore_circuits.circuit.hamiltonian import purcell_t1_us # pylint: disable=import-outside-toplevel
192
+ from quantcore_circuits.loop import pair_plot_id # pylint: disable=import-outside-toplevel
193
+ from quantcore_circuits.pdk import get_pdk # pylint: disable=import-outside-toplevel
194
+
195
+ pdk = get_pdk(design.pdk)
196
+ st = pdk.stack
197
+ rows = an.rows
198
+ filled = an.filled
199
+ c = _Cards()
200
+ fem = filled.cmatrix is not None
201
+ origin = f"FEM · {filled.job}" if fem else "layout estimates (no FEM yet)"
202
+ # the analysis' own plan when it is of this design (loop.analyse planned it already), else plan it here
203
+ plan = getattr(an, "plan", None)
204
+ if plan is None or getattr(plan, "design", None) is None or plan.design.to_json_dict() != design.to_json_dict():
205
+ plan = plan_design(design)
206
+ topo = _Topology(design, an.model, plan)
207
+ pairs = filled.pairs
208
+
209
+ f_ref = next((design.targets.get(p.resonator, {}).get("f_GHz") for p in pairs), None) or 7.0
210
+ cpw = cpw_properties(f_ref, pdk.cpw_a, pdk.cpw_b, design.pdk)
211
+ summary = [
212
+ {
213
+ "id": "process",
214
+ "index": "0",
215
+ "title": "Process and CPW",
216
+ "items": [
217
+ {"label": "Substrate", "value": f"{st.substrate_material} {st.substrate_height:g} µm"},
218
+ {"label": "Permittivity", "symbol": "\\varepsilon_r", "value": st.substrate_permittivity},
219
+ {"label": "Effective permittivity", "symbol": "\\varepsilon_{eff}", "value": round(cpw["eps_eff"], 4)},
220
+ {"label": "Impedance", "symbol": "Z_0", "value": round(cpw["Z0_ohm"], 2), "unit": "Ω"},
221
+ {"label": f"CPW λ/4 at {f_ref:g} GHz", "value": round(cpw["lambda_um"] / 4 / 1e3, 4), "unit": "mm"},
222
+ {"label": "CPW centre / gap", "value": f"{pdk.cpw_a:g} / {pdk.cpw_b:g} µm"},
223
+ {"label": "Values from", "value": origin},
224
+ ],
225
+ }
226
+ ]
227
+
228
+ # ---- chip: process and CPW ------------------------------------------------------------------------------------
229
+ c.section("process", "0", "Process and CPW", f"{design.pdk} · values from {origin}")
230
+ c.card(
231
+ "process",
232
+ CHIP,
233
+ "Substrate",
234
+ "\\varepsilon_r",
235
+ st.substrate_permittivity,
236
+ "",
237
+ ident="chip.substrate",
238
+ sub=[
239
+ {"symbol": "h", "value": st.substrate_height, "unit": "µm"},
240
+ {"symbol": "\\varepsilon_{eff}", "value": cpw["eps_eff"], "unit": ""},
241
+ ],
242
+ source="pdk",
243
+ description=f"{st.substrate_material}; ε_eff of the CPW from conformal mapping.",
244
+ formula="\\varepsilon_{eff} \\approx (\\varepsilon_r + 1)/2",
245
+ )
246
+ i_cpw = c.card(
247
+ "process",
248
+ CHIP,
249
+ "CPW line",
250
+ "Z_0",
251
+ cpw["Z0_ohm"],
252
+ "Ω",
253
+ ident="chip.cpw",
254
+ sub=[
255
+ {"symbol": "a", "value": pdk.cpw_a, "unit": "µm"},
256
+ {"symbol": "b", "value": pdk.cpw_b, "unit": "µm"},
257
+ {"symbol": "v_p/c", "value": cpw["vp_m_s"] / 2.998e8, "unit": ""},
258
+ ],
259
+ source="pdk",
260
+ description="PDK default centre width a and gap b.",
261
+ formula="Z_0 = \\frac{30\\pi}{\\sqrt{\\varepsilon_{eff}}} \\frac{K(k')}{K(k)},\\; k = a/(a+2b)",
262
+ )
263
+ c.card(
264
+ "process",
265
+ CHIP,
266
+ f"Quarter wave at {f_ref:g} GHz",
267
+ "\\lambda/4",
268
+ cpw["lambda_um"] / 4,
269
+ "µm",
270
+ ident="chip.lambda4",
271
+ source="pdk",
272
+ **{"from": [{"label": "v_p", "value": _fmt(cpw["vp_m_s"] / 1e8, "×10⁸ m/s"), "ref": i_cpw}]},
273
+ formula="\\lambda/4 = v_p / 4f",
274
+ description="Reference length of a λ/4 CPW resonator on this stack.",
275
+ )
276
+
277
+ # FEM net → simulation self-capacitance card id (filled in below, referenced from the pair cards)
278
+ sim_self = {lab: f"sim.self.{lab}" for lab in (filled.cmatrix or {}).get("labels", [])} if fem else {}
279
+
280
+ # ---- per transmon–resonator pair -----------------------------------------------------------------------------
281
+ elements: dict[str, dict] = {}
282
+ done_qubits: set[str] = set()
283
+ for p in pairs:
284
+ q, r = p.qubit, p.resonator
285
+ pr = f"{q}{r}"
286
+ tn = two_node_model(p)
287
+ fq, al = _row(rows, f"{q}.f_q_GHz"), _row(rows, f"{q}.alpha_MHz")
288
+ fr, gg, chi = _row(rows, f"{r}.f_GHz"), _row(rows, f"{r}.g_MHz"), _row(rows, f"{r}.chi_MHz")
289
+ jname = topo.qubit_junction.get(q, f"J_{q}")
290
+ syn = filled.values[jname].design if jname in filled.values else None
291
+ cq = filled.values.get(f"C_{q}")
292
+ cnode = topo.resonators.get(r, {}).get("node")
293
+ cgv = next((v for v in filled.values.values() if v.type == "C" and set(v.nodes) == {q, cnode}), None)
294
+ cgv = cgv or next((v for n, v in filled.values.items() if n.startswith(f"Cg_{q}_")), None)
295
+ tlv = filled.values.get(r)
296
+ hv = filled.values.get(f"K_{r}")
297
+ res = an.pair_results.get(q) if getattr(an, "pair_results", None) else None
298
+ res = res if res and res["resonator"] == r else None # QuTiP solved this qubit with this resonator
299
+ id_cs, id_j, id_cg, id_cpw_r = f"{q}.csigma", f"{q}.junction", f"{pr}.cg", f"{r}.cpw"
300
+
301
+ if q not in done_qubits:
302
+ done_qubits.add(q)
303
+ inst = design.instances.get(q)
304
+ jtype = (inst.params.get("junction_type") if inst else None) or ("SQUID" if p.squid else "JJ")
305
+ c.section(f"qubit_{q}", "A", f"Qubit {q}", "Capacitance first, then the junction and the frequency plan.")
306
+ c.card(
307
+ f"qubit_{q}",
308
+ q,
309
+ "Qubit capacitance",
310
+ "C_\\Sigma",
311
+ tn["C_sigma_fF"],
312
+ "fF",
313
+ ident=id_cs,
314
+ sub=[
315
+ {"symbol": "E_C/h", "value": tn["EC_GHz"] * 1e3, "unit": "MHz"},
316
+ {"symbol": "C_{island}", "value": cq.value if cq else None, "unit": "fF"},
317
+ ],
318
+ design=(cq.design + (cgv.design or 0) + p.cj_fF) if cq and cq.design and cgv else None,
319
+ source=(cq.origin if cq else None),
320
+ **{
321
+ "from": [
322
+ {
323
+ "label": "C_island",
324
+ "value": _fmt(cq.value if cq else None, "fF"),
325
+ "ref": sim_self.get(p.labels[0]),
326
+ },
327
+ {"label": "C_g", "value": _fmt(p.cg_fF, "fF"), "ref": id_cg},
328
+ {"label": "C_J", "value": _fmt(p.cj_fF, "fF"), "ref": id_j},
329
+ ]
330
+ },
331
+ formula="E_C = e^2 / 2C_\\Sigma",
332
+ description="Total island capacitance including the loaded coupler; sets E_C and the anharmonicity.",
333
+ )
334
+ ic = ic_from_lj(p.lj_nH)
335
+ c.card(
336
+ f"qubit_{q}",
337
+ q,
338
+ "Junction",
339
+ "L_J",
340
+ p.lj_nH,
341
+ "nH",
342
+ ident=id_j,
343
+ sub=[
344
+ {"symbol": "E_J/h", "value": tn["EJ_GHz"], "unit": "GHz"},
345
+ {"symbol": "I_c", "value": ic * 1e9, "unit": "nA"},
346
+ {"symbol": "R_n", "value": rn_from_ic(ic), "unit": "Ω"},
347
+ ],
348
+ design=syn,
349
+ source="design.json",
350
+ **{"from": [{"label": "junction", "value": f"{jtype} · design.json"}]},
351
+ formula="E_J = (\\Phi_0 / 2\\pi)^2 / L_J,\\; I_c R_n = \\pi\\Delta_{Nb}/2e",
352
+ description="Total Josephson inductance at zero flux; R_n from Ambegaokar–Baratoff with Δ_Nb.",
353
+ )
354
+ c.card(
355
+ f"qubit_{q}",
356
+ q,
357
+ "Qubit frequency",
358
+ "f_{01}",
359
+ _chosen(fq),
360
+ "GHz",
361
+ ident=f"{q}.f01",
362
+ target=_target(fq),
363
+ range=_range(fq),
364
+ source=fq.chosen_by if fq else None,
365
+ status=_status(fq),
366
+ **{
367
+ "from": [
368
+ {"label": "E_J", "value": _fmt(tn["EJ_GHz"], "GHz"), "ref": id_j},
369
+ {"label": "E_C", "value": _fmt(tn["EC_GHz"] * 1e3, "MHz"), "ref": id_cs},
370
+ ]
371
+ },
372
+ formula="f_{01} \\approx \\sqrt{8E_JE_C} - E_C",
373
+ plot=pair_plot_id("levels", q, an) if res and res["dressed"] else None,
374
+ description="Dressed 0→1 transition; the range is the spread over the estimators.",
375
+ )
376
+ c.card(
377
+ f"qubit_{q}",
378
+ q,
379
+ "Anharmonicity",
380
+ "\\alpha/2\\pi",
381
+ _chosen(al),
382
+ "MHz",
383
+ ident=f"{q}.alpha",
384
+ target=_target(al),
385
+ range=_range(al),
386
+ source=al.chosen_by if al else None,
387
+ status=_status(al),
388
+ **{"from": [{"label": "E_C", "value": _fmt(tn["EC_GHz"] * 1e3, "MHz"), "ref": id_cs}]},
389
+ formula="\\alpha \\approx -E_C",
390
+ description="E₁₂ − E₀₁; mostly set by C_Σ.",
391
+ )
392
+ f0, _ = transmon_spectrum(tn["EJ_GHz"], tn["EC_GHz"], 0.0)
393
+ f5, _ = transmon_spectrum(tn["EJ_GHz"], tn["EC_GHz"], 0.5)
394
+ c.card(
395
+ f"qubit_{q}",
396
+ q,
397
+ "Transmon regime",
398
+ "E_J/E_C",
399
+ tn["EJ_GHz"] / tn["EC_GHz"],
400
+ "",
401
+ ident=f"{q}.ejec",
402
+ sub=[{"symbol": "\\epsilon_{01}", "value": abs(f0 - f5) * 1e6, "unit": "kHz"}],
403
+ formula="\\epsilon_{01} = |f_{01}(n_g{=}0) - f_{01}(n_g{=}\\tfrac12)|",
404
+ description="Charge dispersion of the 0→1 line; E_J/E_C ≳ 50 keeps it small.",
405
+ )
406
+ if p.squid:
407
+ ej_sum = tn["EJ_GHz"] * p.ej_sum_ratio # E_J at zero flux (tn is at the design flux)
408
+ fmin, _ = transmon_spectrum(max(squid_ej(ej_sum, p.asym, 0.45), 1e-6), tn["EC_GHz"])
409
+ pad = topo.flux.get(q)
410
+ c.card(
411
+ f"qubit_{q}",
412
+ q,
413
+ "Flux tuning",
414
+ "f_{max}",
415
+ f0,
416
+ "GHz",
417
+ ident=f"{q}.flux",
418
+ sub=[{"symbol": "f(\\pm0.45\\Phi_0)", "value": fmin, "unit": "GHz"}],
419
+ plot=pair_plot_id("flux", q, an) if res and res["flux"] else None,
420
+ formula="E_J(\\Phi) = E_{J\\Sigma}|\\cos \\pi\\Phi/\\Phi_0|",
421
+ **({"from": [_flux_ref(topo, pad)]} if pad else {}),
422
+ description="Symmetric SQUID; flux line from the bias pad.",
423
+ )
424
+
425
+ c.section(f"res_{r}", "B", f"Readout resonator {r}", "λ/4 meander hanging off the feedline.")
426
+ id_len = c.card(
427
+ f"res_{r}",
428
+ r,
429
+ "Resonator length",
430
+ "\\ell",
431
+ tlv.estimate if tlv else None,
432
+ "µm",
433
+ ident=f"{r}.length",
434
+ design=tlv.design if tlv else None,
435
+ source="layout",
436
+ **{"from": [{"label": "route", "value": f"{r} meander"}]},
437
+ description="Routed length, tuned exactly by the meander.",
438
+ )
439
+ c.card(
440
+ f"res_{r}",
441
+ r,
442
+ "Resonator frequency",
443
+ "f_r",
444
+ _chosen(fr),
445
+ "GHz",
446
+ ident=f"{r}.f_r",
447
+ target=_target(fr),
448
+ range=_range(fr),
449
+ source=fr.chosen_by if fr else None,
450
+ status=_status(fr),
451
+ sub=[
452
+ {"symbol": "f_{\\lambda/4}", "value": p.f_r_GHz, "unit": "GHz"},
453
+ {"symbol": "f_{loaded}", "value": tn["f_r_loaded_GHz"], "unit": "GHz"},
454
+ ],
455
+ **{
456
+ "from": [
457
+ {"label": "ℓ", "value": _fmt(tlv.estimate if tlv else None, "µm"), "ref": id_len},
458
+ {"label": "C_claw", "value": _fmt(p.c_coupler_fF, "fF"), "ref": sim_self.get(p.labels[1])},
459
+ ]
460
+ },
461
+ formula="f_{\\lambda/4} = v_p / 4\\ell",
462
+ plot=pair_plot_id("readout", q, an) if res and res["readout"] else None,
463
+ description="Dressed resonator frequency; the claw capacitance pulls the bare λ/4 down.",
464
+ )
465
+ cr = tn["C_r_fF"]
466
+ c.card(
467
+ f"res_{r}",
468
+ r,
469
+ "CPW line",
470
+ "Z_0",
471
+ p.z0_ohm,
472
+ "Ω",
473
+ ident=id_cpw_r,
474
+ sub=[
475
+ {"symbol": "C_r", "value": cr, "unit": "fF"},
476
+ {"symbol": "L_r", "value": tn["L_r_nH"], "unit": "nH"},
477
+ {"symbol": "v_p/c", "value": (tlv.extra.get("vp_m_s", 0) / 2.998e8) if tlv else None, "unit": ""},
478
+ ],
479
+ formula="C_r = \\pi/4\\omega_r Z_0,\\; L_r = 4Z_0/\\pi\\omega_r",
480
+ description="λ/4 seen from its open end as a parallel LC.",
481
+ )
482
+ kap = hv.value if hv else None
483
+ fqv, frv, gv = _chosen(fq), _chosen(fr), _chosen(gg)
484
+ t1 = purcell_t1_us(fqv, frv, gv, kap) if kap and fqv and frv and gv else None
485
+ if kap:
486
+ c.card(
487
+ f"res_{r}",
488
+ r,
489
+ "Linewidth",
490
+ "\\kappa/2\\pi",
491
+ kap,
492
+ "MHz",
493
+ ident=f"{r}.kappa",
494
+ sub=[
495
+ {"symbol": "Q_{ext}", "value": (frv or p.f_r_GHz) * 1e3 / kap, "unit": ""},
496
+ {"symbol": "T_1^{Purcell}", "value": t1, "unit": "µs"},
497
+ ],
498
+ source=hv.origin,
499
+ status="info",
500
+ **{
501
+ "from": [
502
+ {
503
+ "label": "hanger",
504
+ "value": f"{hv.extra.get('coupling_length_um', 0):g} µm · "
505
+ f"gap {hv.extra.get('ground_gap_um', 0):g} µm",
506
+ "ref": p.feedline,
507
+ }
508
+ ]
509
+ },
510
+ formula="Q_{ext} = \\pi / 2k^2\\sin^2\\beta l_c",
511
+ description="Coupled-line estimate (calibrate k from a driven simulation).",
512
+ )
513
+
514
+ c.section(f"coupling_{pr}", "C", f"Coupling {q}–{r}", "Claw capacitance, exchange coupling, dispersive shift.")
515
+ c.card(
516
+ f"coupling_{pr}",
517
+ q,
518
+ "Coupling capacitance",
519
+ "C_g",
520
+ p.cg_fF,
521
+ "fF",
522
+ ident=id_cg,
523
+ partner=r,
524
+ design=cgv.design if cgv else None,
525
+ source=cgv.origin if cgv else None,
526
+ sub=[{"symbol": "\\beta = C_g/C_\\Sigma", "value": p.cg_fF / tn["C_sigma_fF"], "unit": ""}],
527
+ description="Island ↔ claw capacitance (C-matrix off-diagonal).",
528
+ )
529
+ g_val = gv if gg else tn["g_MHz"]
530
+ c.card(
531
+ f"coupling_{pr}",
532
+ q,
533
+ "Coupling",
534
+ "g/2\\pi",
535
+ g_val,
536
+ "MHz",
537
+ ident=f"{pr}.g",
538
+ partner=r,
539
+ target=_target(gg),
540
+ range=_range(gg),
541
+ source=gg.chosen_by if gg else "2-node",
542
+ status=_status(gg),
543
+ **{
544
+ "from": [
545
+ {"label": "C_g", "value": _fmt(p.cg_fF, "fF"), "ref": id_cg},
546
+ {"label": "C_r", "value": _fmt(cr, "fF"), "ref": id_cpw_r},
547
+ ]
548
+ },
549
+ formula="\\hbar g = 2e\\beta V_{zpf}\\langle 1|\\hat n|0\\rangle",
550
+ description="Exchange coupling of the qubit to the resonator.",
551
+ )
552
+ ro = res["readout"] if res else None
553
+ c.card(
554
+ f"coupling_{pr}",
555
+ q,
556
+ "Dispersive shift",
557
+ "\\chi/2\\pi",
558
+ _chosen(chi),
559
+ "MHz",
560
+ ident=f"{pr}.chi",
561
+ partner=r,
562
+ range=_range(chi),
563
+ source=chi.chosen_by if chi else None,
564
+ status="warn" if chi and chi.flagged else None,
565
+ sub=[
566
+ {"symbol": "\\chi_{readout}", "value": ro["chi_readout_MHz"] if ro else None, "unit": "MHz"},
567
+ {"symbol": "\\chi/\\kappa", "value": (chi.chosen / kap) if chi and kap else None, "unit": ""},
568
+ ],
569
+ formula="\\chi = E_{11} - E_{10} - E_{01} + E_{00}",
570
+ plot=pair_plot_id("readout", q, an) if ro else None,
571
+ description="Full resonator shift between qubit |g⟩ and |e⟩"
572
+ + ("; QuTiP readout simulation cross-checks it." if ro else "."),
573
+ )
574
+ delta = fqv - frv if fqv is not None and frv is not None else None
575
+ if delta is not None:
576
+ c.card(
577
+ f"coupling_{pr}",
578
+ q,
579
+ "Detuning",
580
+ "\\Delta/2\\pi",
581
+ delta,
582
+ "GHz",
583
+ ident=f"{pr}.delta",
584
+ partner=r,
585
+ sub=[{"symbol": "g/\\Delta", "value": (g_val / 1e3) / abs(delta) if delta else None, "unit": ""}],
586
+ description="Qubit–resonator detuning; g/Δ ≪ 1 for the dispersive regime.",
587
+ )
588
+
589
+ # elements: the qubit row carries its readout's values (one row per qubit in the overview)
590
+ qe = elements.setdefault(q, _element(q, "qubit", q, _qubit_subtitle(design, q, p.squid)))
591
+ if not qe["params"]:
592
+ qe["params"] = [
593
+ _param("f_q", "Qubit frequency", "f_{01}", fqv, "GHz", fq, f"{q}.f01"),
594
+ _param("alpha", "Anharmonicity", "\\alpha/2\\pi", _chosen(al), "MHz", al, f"{q}.alpha"),
595
+ _param("EJ_EC", "Transmon regime", "E_J/E_C", tn["EJ_GHz"] / tn["EC_GHz"], "", card=f"{q}.ejec"),
596
+ _param("E_C", "Charging energy", "E_C/h", tn["EC_GHz"] * 1e3, "MHz", card=id_cs),
597
+ _param("f_r", "Readout frequency", "f_r", frv, "GHz", fr, f"{r}.f_r", of=r),
598
+ _param("g", "Coupling", "g/2\\pi", g_val, "MHz", gg, f"{pr}.g", of=r),
599
+ _param("chi", "Dispersive shift", "\\chi/2\\pi", _chosen(chi), "MHz", chi, f"{pr}.chi", of=r),
600
+ _param("kappa", "Linewidth", "\\kappa/2\\pi", kap, "MHz", card=f"{r}.kappa" if kap else None, of=r),
601
+ _param("delta", "Detuning", "\\Delta/2\\pi", delta, "GHz", card=f"{pr}.delta", of=r),
602
+ _param("T1_purcell", "Purcell limit", "T_1^{P}", t1, "µs", card=f"{r}.kappa" if kap else None, of=r),
603
+ ]
604
+ qe["links"].append({"to": r, "role": "readout"})
605
+ if q in topo.flux and not any(x["role"] == "flux" for x in qe["links"]):
606
+ qe["links"].append({"to": topo.flux[q], "role": "flux", "label": topo.ports[topo.flux[q]]["line"]})
607
+ re_ = elements.setdefault(
608
+ r, _element(r, "resonator", r, f"λ/4 · hanger on {p.feedline}" if p.feedline else "λ/4")
609
+ )
610
+ re_["params"] = [
611
+ _param("f_r", "Resonator frequency", "f_r", frv, "GHz", fr, f"{r}.f_r"),
612
+ _param("length", "Length", "\\ell", tlv.estimate if tlv else None, "µm", card=f"{r}.length"),
613
+ _param("kappa", "Linewidth", "\\kappa/2\\pi", kap, "MHz", card=f"{r}.kappa" if kap else None),
614
+ _param(
615
+ "Q_ext",
616
+ "External Q",
617
+ "Q_{ext}",
618
+ (frv or p.f_r_GHz) * 1e3 / kap if kap else None,
619
+ "",
620
+ card=f"{r}.kappa" if kap else None,
621
+ ),
622
+ _param("Z0", "Impedance", "Z_0", p.z0_ohm, "Ω", card=id_cpw_r),
623
+ ]
624
+ re_["links"] = [{"to": q, "role": "readout"}] + ([{"to": p.feedline, "role": "feedline"}] if p.feedline else [])
625
+
626
+ # ---- qubits without a readout pair, buses, direct couplers --------------------------------------------------
627
+ for q in topo.qubits:
628
+ if q in done_qubits:
629
+ continue
630
+ jv = filled.values.get(topo.qubit_junction[q])
631
+ fq, al = _row(rows, f"{q}.f_q_GHz"), _row(rows, f"{q}.alpha_MHz")
632
+ c.section(f"qubit_{q}", "A", f"Qubit {q}", "No λ/4 readout found in the circuit.")
633
+ c.card(
634
+ f"qubit_{q}",
635
+ q,
636
+ "Junction",
637
+ "L_J",
638
+ jv.value if jv else None,
639
+ "nH",
640
+ ident=f"{q}.junction",
641
+ design=jv.design if jv else None,
642
+ source="design.json",
643
+ )
644
+ for key, row, title, sym, unit in (
645
+ ("f01", fq, "Qubit frequency", "f_{01}", "GHz"),
646
+ ("alpha", al, "Anharmonicity", "\\alpha/2\\pi", "MHz"),
647
+ ):
648
+ if row is not None:
649
+ c.card(
650
+ f"qubit_{q}",
651
+ q,
652
+ title,
653
+ sym,
654
+ row.chosen,
655
+ unit,
656
+ ident=f"{q}.{key}",
657
+ target=_target(row),
658
+ range=_range(row),
659
+ source=row.chosen_by,
660
+ status=_status(row),
661
+ )
662
+ e = elements.setdefault(
663
+ q, _element(q, "qubit", q, _qubit_subtitle(design, q, jv is not None and jv.type == "SQUID"))
664
+ )
665
+ e["params"] = [
666
+ _param("f_q", "Qubit frequency", "f_{01}", _chosen(fq), "GHz", fq, f"{q}.f01" if fq else None),
667
+ _param("alpha", "Anharmonicity", "\\alpha/2\\pi", _chosen(al), "MHz", al, f"{q}.alpha" if al else None),
668
+ ]
669
+ if q in topo.flux:
670
+ e["links"].append({"to": topo.flux[q], "role": "flux", "label": topo.ports[topo.flux[q]]["line"]})
671
+
672
+ for rname, info in topo.resonators.items():
673
+ if rname in elements:
674
+ continue
675
+ tlv = filled.values.get(rname)
676
+ f_bus = tlv.extra.get("f_GHz") if tlv else None
677
+ kind = info["kind"]
678
+ sec = f"{'bus' if kind == 'bus' else 'res'}_{rname}"
679
+ c.section(sec, "B", f"{'Bus' if kind == 'bus' else 'Resonator'} {rname}", " – ".join(info["qubits"]))
680
+ c.card(sec, rname, "Resonator length", "\\ell", tlv.estimate if tlv else None, "µm", ident=f"{rname}.length")
681
+ c.card(
682
+ sec,
683
+ rname,
684
+ "Bare frequency",
685
+ "f",
686
+ f_bus,
687
+ "GHz",
688
+ ident=f"{rname}.f",
689
+ source="layout",
690
+ description=f"{tlv.extra.get('kind', '')} from the routed length." if tlv else None,
691
+ )
692
+ e = elements.setdefault(rname, _element(rname, kind, rname, tlv.extra.get("kind", "") if tlv else ""))
693
+ e["params"] = [
694
+ _param("f_r", "Bare frequency", "f", f_bus, "GHz", card=f"{rname}.f"),
695
+ _param("length", "Length", "\\ell", tlv.estimate if tlv else None, "µm", card=f"{rname}.length"),
696
+ ]
697
+ e["links"] = [{"to": q, "role": "coupling"} for q in info["qubits"]]
698
+ e["links"] += [{"to": info["feedline"], "role": "feedline"}] if info["feedline"] else []
699
+ for q in info["qubits"]:
700
+ if q in elements:
701
+ elements[q]["links"].append({"to": rname, "role": "coupling"})
702
+
703
+ for cname, (qa, qb) in topo.couplers.items():
704
+ v = filled.values.get(cname)
705
+ c.section(f"coupler_{cname}", "C", f"Coupler {qa}–{qb}", "Direct island–island capacitance.")
706
+ c.card(
707
+ f"coupler_{cname}",
708
+ cname,
709
+ "Coupling capacitance",
710
+ "C_c",
711
+ v.value if v else None,
712
+ "fF",
713
+ ident=f"{cname}.C",
714
+ design=v.design if v else None,
715
+ source=v.origin if v else None,
716
+ )
717
+ e = elements.setdefault(cname, _element(cname, "coupler", f"{qa}–{qb}", "capacitive"))
718
+ e["params"] = [_param("C", "Capacitance", "C_c", v.value if v else None, "fF", card=f"{cname}.C")]
719
+ e["links"] = [{"to": qa, "role": "coupling"}, {"to": qb, "role": "coupling"}]
720
+ for q in (qa, qb):
721
+ if q in elements:
722
+ elements[q]["links"].append({"to": cname, "role": "coupling"})
723
+
724
+ for fl in topo.feedlines:
725
+ on = [r for r, i in topo.resonators.items() if i["feedline"] == fl]
726
+ fl_ports = topo.fl_ports.get(fl, [])
727
+ e = elements.setdefault(fl, _element(fl, "feedline", fl, f"{len(on)} resonator{'s' if len(on) != 1 else ''}"))
728
+ e["params"] = [
729
+ _param("Z0", "Impedance", "Z_0", cpw["Z0_ohm"], "Ω", card="chip.cpw"),
730
+ _param("length", "Length", "\\ell", topo.feedline_length.get(fl), "µm"),
731
+ _param("n_res", "Resonators", "n_r", len(on), ""),
732
+ ]
733
+ e["links"] = [{"to": r, "role": "readout"} for r in on] + [{"to": pt, "role": "port"} for pt in fl_ports]
734
+ for pad, info in topo.ports.items():
735
+ if pad in elements:
736
+ continue
737
+ e = elements.setdefault(
738
+ pad, _element(pad, "port", pad, f"{'flux bias' if info['role'] == 'flux' else 'feedline port'}")
739
+ )
740
+ flux = info["role"] == "flux"
741
+ e["params"] = [_param("length", "Line length", "\\ell", info["length_um"], "µm")] if flux else []
742
+ e["links"] = [{"to": info["to"], "role": info["role"], "label": info["line"]}]
743
+
744
+ # ---- chip: simulation, jobs, feedback ------------------------------------------------------------------------
745
+ if fem:
746
+ cm = filled.cmatrix
747
+ c.section("simulation", "D", "Simulation", f"{filled.job}")
748
+ labels, m = cm["labels"], cm["matrix"]
749
+ for i, li in enumerate(labels):
750
+ c.card(
751
+ "simulation",
752
+ CHIP,
753
+ f"Self capacitance {li}",
754
+ f"C_{{{i + 1}{i + 1}}}",
755
+ m[i][i],
756
+ "fF",
757
+ ident=sim_self[li],
758
+ **{"from": [{"label": "net", "value": li, "ref": _net_element(li, elements)}]},
759
+ description="Maxwell diagonal (total to all others).",
760
+ )
761
+ mutual = [(i, j) for i in range(len(labels)) for j in range(i + 1, len(labels))]
762
+ mutual.sort(key=lambda ij: -abs(m[ij[0]][ij[1]]))
763
+ for i, j in sorted(mutual[:24]):
764
+ c.card(
765
+ "simulation",
766
+ CHIP,
767
+ f"Mutual {labels[i]} ↔ {labels[j]}",
768
+ f"C_{{{i + 1}{j + 1}}}",
769
+ -m[i][j],
770
+ "fF",
771
+ ident=f"sim.mutual.{labels[i]}.{labels[j]}",
772
+ description="Branch capacitance between the two nets (−Maxwell off-diagonal).",
773
+ )
774
+ notes = list(filled.notes)
775
+ if len(mutual) > 24:
776
+ notes.append(f"{len(mutual) - 24} smaller mutual capacitances: see the C-matrix in the Simulation tab")
777
+ if notes:
778
+ c.cards[-1].setdefault("notes", []).extend(notes)
779
+ if jobs:
780
+ c.section("jobs", "J", "Simulation jobs", "Exported, rendered and solved jobs.")
781
+ for job in jobs or []:
782
+ c.card(
783
+ "jobs",
784
+ CHIP,
785
+ job["name"],
786
+ job["analysis"],
787
+ None,
788
+ "",
789
+ ident=f"job.{job['name']}",
790
+ status="pass" if job.get("hasResults") else "info",
791
+ **{"from": [{"label": "status", "value": job["status"]}, {"label": "solver", "value": job["solver"]}]},
792
+ description=f"group {job['group']}" + (f" · {job['project']}" if job.get("project") else ""),
793
+ )
794
+ if proposal is not None:
795
+ c.section("feedback", "E", "Feedback", "Next design revision from the surrogate (prediction until simulated).")
796
+ for k, v in proposal.knobs.items():
797
+ old = proposal.start_knobs.get(k)
798
+ unit = "nH" if k.endswith("Lj_nH") else "µm"
799
+ owner = k.split(".", 1)[0]
800
+ c.card(
801
+ "feedback",
802
+ CHIP,
803
+ k,
804
+ k.split(".")[-1].replace("_", "\\_"),
805
+ v,
806
+ unit,
807
+ ident=f"fb.{k}",
808
+ sub=[{"symbol": "now", "value": old, "unit": unit}],
809
+ status="warn" if k in proposal.at_bounds else None,
810
+ **({"from": [{"label": "element", "value": "", "ref": owner}]} if owner in elements else {}),
811
+ description=(
812
+ "at its bound — widen it or add a knob"
813
+ if k in proposal.at_bounds
814
+ else f"{100 * (v - old) / old:+.1f} % vs now"
815
+ if old
816
+ else ""
817
+ ),
818
+ )
819
+ n_t = len(proposal.residuals) if getattr(proposal, "residuals", None) else None
820
+ c.card(
821
+ "feedback",
822
+ CHIP,
823
+ "Predicted residual",
824
+ "\\lVert r \\rVert",
825
+ proposal.objective,
826
+ "tol",
827
+ ident="fb.residual",
828
+ description="Norm of (predicted − target)/tol"
829
+ + (f" over the {n_t} targets" if n_t else "")
830
+ + " after this revision.",
831
+ )
832
+
833
+ for e in elements.values():
834
+ e["status"] = _worst(e["params"])
835
+ return {"sections": c.sections, "cards": c.cards, "summary": summary, "elements": _ordered(elements)}
836
+
837
+
838
+ def _flux_ref(topo, pad) -> dict:
839
+ line = topo.ports[pad]
840
+ length = f" · {line['length_um']:.4g} µm" if line.get("length_um") else ""
841
+ return {"label": "flux line", "value": f"{line['line']}{length}", "ref": pad}
842
+
843
+
844
+ def _element(ident, kind, label, subtitle="") -> dict:
845
+ return {"id": ident, "kind": kind, "label": label, "subtitle": subtitle, "params": [], "links": []}
846
+
847
+
848
+ def _qubit_subtitle(design, q, squid) -> str:
849
+ inst = design.instances.get(q)
850
+ cell = inst.cell.rsplit(".", 1)[-1] if inst else "transmon"
851
+ jt = (inst.params.get("junction_type") if inst else None) or ("SQUID" if squid else "JJ")
852
+ return f"{cell} · {jt}"
853
+
854
+
855
+ def _net_element(net: str, elements: dict) -> str | None:
856
+ """FEM net → element id ("Q1.island" → "Q1"; a claw → its readout resonator), for the self-capacitance chips."""
857
+ head = net.split(".", 1)[0]
858
+ if net.endswith(".island") or net == head:
859
+ return head if head in elements else None
860
+ readout = next((x["to"] for x in elements.get(head, {}).get("links", []) if x["role"] == "readout"), None)
861
+ return readout or (head if head in elements else None)
862
+
863
+
864
+ _KIND_ORDER = {"qubit": 0, "resonator": 1, "bus": 2, "coupler": 3, "feedline": 4, "port": 5}
865
+
866
+
867
+ def _natural(s: str):
868
+ import re # pylint: disable=import-outside-toplevel
869
+
870
+ return [int(t) if t.isdigit() else t for t in re.split(r"(\d+)", s)]
871
+
872
+
873
+ def _ordered(elements: dict) -> list[dict]:
874
+ return sorted(elements.values(), key=lambda e: (_KIND_ORDER.get(e["kind"], 9), _natural(e["id"])))
875
+
876
+
877
+ def _isfinite(v) -> bool:
878
+ return v is not None and isinstance(v, (int, float)) and math.isfinite(v)