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,462 @@
1
+ """Quantum Metal side of the ``metal:<Class>`` wrapper: class lookup, option handling and geometry extraction.
2
+
3
+ Quantum Metal is imported lazily (the first import takes 5–13 s), so importing this module is cheap and works
4
+ inside the KLayout GUI, where Metal is usually not installed.
5
+
6
+ * :func:`qlibrary_index` lists the ``qiskit_metal.qlibrary`` components by reading their source (no import).
7
+ * :func:`template_options` / :func:`normalise_options` validate user options against the class defaults. Bare
8
+ numbers on length options (defaults such as ``'30um'``) are µm, as everywhere in quantcore_circuits.
9
+ * :func:`metal_geometry` instantiates the component once in a shared headless ``DesignPlanar`` at the origin with
10
+ orientation 0, reads its rows of ``design.qgeometry.tables`` (``poly``, ``path``, ``junction``) and its pins,
11
+ converts design units (mm) to µm, then deletes the component. Results are cached per (class, options, a, b).
12
+
13
+ The Element's ``a``/``b`` drive Metal's design variables ``cpw_width``/``cpw_gap``, so Metal pins that default to
14
+ ``cpw_width`` match the chip's CPW.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ import ast
20
+ import importlib
21
+ import importlib.util
22
+ import itertools
23
+ import json
24
+ import logging
25
+ import math
26
+ import re
27
+ from dataclasses import dataclass, field
28
+ from functools import cache, lru_cache
29
+ from pathlib import Path
30
+
31
+ from kqcircuits.pya_resolver import pya
32
+
33
+ _LENGTH = re.compile(r"^\s*[-+]?(\d+\.?\d*|\.\d+)([eE][-+]?\d+)?\s*(nm|um|µm|mm|cm|m)\s*$")
34
+ _NUMBER = re.compile(r"^\s*[-+]?(\d+\.?\d*|\.\d+)([eE][-+]?\d+)?\s*$")
35
+
36
+ # options set by our placement, never by the user (Metal components are built at the origin, orientation 0)
37
+ PLACEMENT_OPTIONS = ("pos_x", "pos_y", "orientation")
38
+
39
+ # Metal qlibrary sub-package → quantcore category (refined per class in METAL_CATEGORY_OVERRIDES)
40
+ METAL_PACKAGE_CATEGORY = {
41
+ "qubits": "qubit",
42
+ "couplers": "coupler",
43
+ "lumped": "capacitor",
44
+ "resonators": "resonator",
45
+ "terminations": "launcher",
46
+ "tlines": "waveguide",
47
+ "sample_shapes": "shape",
48
+ "user_components": "other",
49
+ }
50
+ METAL_CATEGORY_OVERRIDES = {
51
+ "jj_dolan": "junction",
52
+ "jj_manhattan": "junction",
53
+ "SNAIL": "junction",
54
+ "SQUID_LOOP": "junction",
55
+ "BridgeFreeJunction": "junction",
56
+ "OpenToGround": "termination",
57
+ "ShortToGround": "termination",
58
+ "ResonatorCoilRect": "resonator",
59
+ "Airbridge": "airbridge",
60
+ }
61
+ # Metal routes need other components' pins: they are not cells. Map them onto qcc routes instead.
62
+ ROUTE_MAPPING = {
63
+ "RouteStraight": 'route type "cpw" between the two ports (no nodes)',
64
+ "RouteFramed": 'route type "cpw" with Manhattan "nodes" (the router adds the corners)',
65
+ "RouteAnchors": 'route type "cpw" with the anchors as "nodes"',
66
+ "RoutePathfinder": 'route type "cpw" (the qcc router finds a Manhattan path; add "nodes" to steer it)',
67
+ "RouteMeander": 'route type "meander" with "length" (total_length in µm)',
68
+ "RouteMixed": 'route type "meander" with "length" and the anchors as "nodes"',
69
+ }
70
+ # per-class rendering of non-base layers (qgeometry row name → KQC layer, None = skip)
71
+ SPECIAL_LAYERS = {"Airbridge": {"bridge": "airbridge_flyover", "pads": "airbridge_pads", "posts": None}}
72
+
73
+ _log = logging.getLogger(__name__)
74
+
75
+
76
+ # ---- class lookup (no Metal import) -----------------------------------------------------------------------------
77
+ @dataclass(frozen=True)
78
+ class MetalClassInfo:
79
+ name: str
80
+ module: str # qiskit_metal.qlibrary.<pkg>.<module>
81
+ package: str # qlibrary sub-package (qubits, couplers, ...)
82
+ category: str
83
+ description: str
84
+ is_route: bool
85
+
86
+
87
+ @cache
88
+ def qlibrary_root() -> Path | None:
89
+ spec = importlib.util.find_spec("qiskit_metal")
90
+ if spec is None or not spec.submodule_search_locations:
91
+ return None
92
+ return Path(list(spec.submodule_search_locations)[0]) / "qlibrary"
93
+
94
+
95
+ @cache
96
+ def qlibrary_index() -> dict[str, MetalClassInfo]:
97
+ """All public QComponent classes of ``qiskit_metal.qlibrary``, read from source (fast, no import)."""
98
+ root = qlibrary_root()
99
+ if root is None:
100
+ return {}
101
+ raw = {}
102
+ for path in sorted(root.rglob("*.py")):
103
+ rel = path.relative_to(root)
104
+ if rel.parts[0] == "core" or path.stem.startswith("_") or len(rel.parts) < 2:
105
+ continue
106
+ try:
107
+ tree = ast.parse(path.read_text(encoding="utf-8"))
108
+ except (SyntaxError, UnicodeDecodeError):
109
+ continue
110
+ module = "qiskit_metal.qlibrary." + ".".join(rel.with_suffix("").parts)
111
+ for node in tree.body:
112
+ if not isinstance(node, ast.ClassDef) or node.name.startswith("_"):
113
+ continue
114
+ methods = {n.name for n in node.body if isinstance(n, ast.FunctionDef)}
115
+ if "make" not in methods:
116
+ continue
117
+ bases = [ast.unparse(b).rsplit(".", 1)[-1] for b in node.bases]
118
+ doc = (ast.get_docstring(node) or "").strip()
119
+ first = next((ln.strip() for ln in doc.splitlines() if ln.strip() and not ln.strip().startswith("..")), "")
120
+ raw[node.name] = (module, rel.parts[0], bases, first[:160])
121
+ routes = {"QRoute"}
122
+ changed = True
123
+ while changed:
124
+ changed = False
125
+ for name, (_, _, bases, _) in raw.items():
126
+ if name not in routes and routes.intersection(bases):
127
+ routes.add(name)
128
+ changed = True
129
+ out = {}
130
+ for name, (module, pkg, _, doc) in raw.items():
131
+ cat = METAL_CATEGORY_OVERRIDES.get(name, METAL_PACKAGE_CATEGORY.get(pkg, "other"))
132
+ out[name] = MetalClassInfo(name, module, pkg, cat, doc, name in routes)
133
+ return out
134
+
135
+
136
+ def find_class_info(name: str) -> MetalClassInfo | None:
137
+ """Look up a qlibrary class by name: exact, case-insensitive, or by module name (``JJ_Manhattan``)."""
138
+ index = qlibrary_index()
139
+ if name in index:
140
+ return index[name]
141
+ low = name.lower()
142
+ for info in index.values():
143
+ if info.name.lower() == low:
144
+ return info
145
+ by_module = [i for i in index.values() if i.module.rsplit(".", 1)[-1].lower() == low]
146
+ return by_module[0] if len(by_module) == 1 else None
147
+
148
+
149
+ def canonical_class_name(metal_class: str) -> str:
150
+ """Canonical spelling of a Metal class reference (qlibrary class name, or a dotted path kept as is)."""
151
+ if "." in metal_class:
152
+ return metal_class
153
+ info = find_class_info(metal_class)
154
+ if info is None:
155
+ known = ", ".join(sorted(qlibrary_index())) or "(Quantum Metal not installed)"
156
+ raise ValueError(f"unknown Quantum Metal component {metal_class!r}; qlibrary has: {known}")
157
+ return info.name
158
+
159
+
160
+ @cache
161
+ def metal_class(metal_class_ref: str):
162
+ """The QComponent class for a qlibrary name or a dotted path (imports Quantum Metal)."""
163
+ name = canonical_class_name(metal_class_ref)
164
+ if "." in name:
165
+ module_name, _, cls_name = name.rpartition(".")
166
+ else:
167
+ info = qlibrary_index()[name]
168
+ if info.is_route:
169
+ raise ValueError(f"metal:{name} is a Metal route, not a cell: use a qcc {ROUTE_MAPPING.get(name, 'route')}")
170
+ module_name, cls_name = info.module, name
171
+ try:
172
+ module = importlib.import_module(module_name)
173
+ except ImportError as e:
174
+ raise ValueError(f"Quantum Metal component {name!r} cannot be imported: {e}") from e
175
+ cls = getattr(module, cls_name, None)
176
+ if cls is None:
177
+ raise ValueError(f"{module_name!r} has no Quantum Metal component {cls_name!r}")
178
+ return cls
179
+
180
+
181
+ # ---- shared design ----------------------------------------------------------------------------------------------
182
+ _counter = itertools.count()
183
+
184
+
185
+ @cache
186
+ def shared_design():
187
+ """One headless ``DesignPlanar`` reused for every component (components are deleted after reading)."""
188
+ from qiskit_metal import designs # pylint: disable=import-outside-toplevel
189
+
190
+ design = designs.DesignPlanar({}, overwrite_enabled=True)
191
+ design.logger.setLevel(logging.ERROR)
192
+ return design
193
+
194
+
195
+ def _plain(obj):
196
+ """Metal ``Dict``/numpy values → plain JSON-able Python."""
197
+ if isinstance(obj, dict):
198
+ return {str(k): _plain(v) for k, v in obj.items()}
199
+ if isinstance(obj, (list, tuple)):
200
+ return [_plain(v) for v in obj]
201
+ if hasattr(obj, "item") and not isinstance(obj, (str, bytes)):
202
+ try:
203
+ return obj.item()
204
+ except (TypeError, ValueError):
205
+ pass
206
+ return obj
207
+
208
+
209
+ @cache
210
+ def _template_options_json(metal_class_ref: str) -> str:
211
+ cls = metal_class(metal_class_ref)
212
+ return json.dumps(_plain(cls.get_template_options(shared_design())), sort_keys=True, default=str)
213
+
214
+
215
+ def template_options(metal_class_ref: str) -> dict:
216
+ """Default options of a Metal class (fresh copy; nested dicts included, e.g. ``_default_connection_pads``)."""
217
+ return json.loads(_template_options_json(metal_class_ref))
218
+
219
+
220
+ def user_options(metal_class_ref: str) -> list[str]:
221
+ """Option names a user may set (the defaults minus placement and private ``_default_*`` templates)."""
222
+ return sorted(k for k in template_options(metal_class_ref) if not k.startswith("_") and k not in PLACEMENT_OPTIONS)
223
+
224
+
225
+ # Metal's default design variables (qiskit_metal/_defaults.py: cpw_width "10 um", cpw_gap "6 um"); an option whose
226
+ # default is one of them (LaunchpadWirebond* trace_width/trace_gap, couplers' cpw widths) is a length too
227
+ METAL_LENGTH_VARIABLES = ("cpw_width", "cpw_gap")
228
+
229
+
230
+ def is_length(default) -> bool:
231
+ """A Metal option default that is a length: ``'455um'``-style, or one of :data:`METAL_LENGTH_VARIABLES`."""
232
+ return isinstance(default, str) and (bool(_LENGTH.match(default)) or default.strip() in METAL_LENGTH_VARIABLES)
233
+
234
+
235
+ def _normalise(value, default, fallback=None):
236
+ if isinstance(value, dict):
237
+ tmpl = default if isinstance(default, dict) else {}
238
+ return {str(k): _normalise(v, tmpl.get(k, fallback)) for k, v in value.items()}
239
+ if isinstance(value, bool) or value is None:
240
+ return value
241
+ if is_length(default):
242
+ if isinstance(value, (int, float)):
243
+ return f"{value}um"
244
+ if isinstance(value, str) and _NUMBER.match(value):
245
+ return f"{value.strip()}um"
246
+ return value
247
+
248
+
249
+ def flat_options(params: dict | None) -> dict:
250
+ """A metal cell's ``params`` with its ``options`` (a dict, or the JSON text of the PCell form, e.g. what the KLayout
251
+ plugin's parameter table writes) merged into the flat keys; a flat key wins, as in ``MetalComponent.qcc_params``.
252
+ The LOM and the design checks read the flat form."""
253
+ p = dict(params or {})
254
+ opts = p.pop("options", None)
255
+ if isinstance(opts, str):
256
+ opts = json.loads(opts) if opts.strip() else {}
257
+ return {**(opts or {}), **p}
258
+
259
+
260
+ def normalise_options(metal_class_ref: str, options: dict) -> dict:
261
+ """Validate and normalise user options: unknown or placement options raise; bare numbers on length options
262
+ become µm strings (``455`` → ``'455um'``); nested dicts (``connection_pads``) are normalised against their
263
+ ``_default_<name>`` template."""
264
+ defaults = template_options(metal_class_ref)
265
+ placement = sorted(set(options) & set(PLACEMENT_OPTIONS))
266
+ if placement:
267
+ raise ValueError(
268
+ f"metal:{metal_class_ref}: {placement} are set by the placement; use place at/rot instead (Metal "
269
+ "components are built at the origin with orientation 0)"
270
+ )
271
+ unknown = sorted(k for k in options if k not in defaults or k.startswith("_"))
272
+ if unknown:
273
+ raise ValueError(
274
+ f"metal:{metal_class_ref}: unknown option(s) {unknown}; options: {user_options(metal_class_ref)}"
275
+ )
276
+ return {k: _normalise(v, defaults.get(k), defaults.get(f"_default_{k}")) for k, v in options.items()}
277
+
278
+
279
+ def parse_um(value, a: float = 10.0, b: float = 6.0) -> float:
280
+ """A Metal length (``'455um'``, ``'0.455mm'``, ``'cpw_width'``, or a bare number in mm) in µm."""
281
+ design = shared_design()
282
+ design.variables["cpw_width"], design.variables["cpw_gap"] = f"{a}um", f"{b}um"
283
+ return float(design.parse_value(value)) * 1000.0
284
+
285
+
286
+ # ---- geometry ---------------------------------------------------------------------------------------------------
287
+ @dataclass(frozen=True)
288
+ class MetalPin:
289
+ name: str
290
+ middle: tuple[float, float] # µm
291
+ normal: tuple[float, float] # outward unit vector
292
+ width: float # µm
293
+ gap: float # µm
294
+
295
+
296
+ @dataclass(frozen=True)
297
+ class MetalJunction:
298
+ name: str
299
+ points: tuple[tuple[float, float], ...] # µm, the junction line
300
+ width: float # µm
301
+
302
+
303
+ @dataclass(frozen=True)
304
+ class MetalGeometry:
305
+ """A Metal component's geometry in µm (polygons as ``pya.DPolygon``, paths already buffered)."""
306
+
307
+ metal_class: str
308
+ subtract: tuple = () # DPolygons removed from ground
309
+ metal: tuple = () # DPolygons of (non-subtract) metal
310
+ layers: dict = field(default_factory=dict) # KQC layer name → DPolygons (special layers, e.g. airbridges)
311
+ junctions: tuple[MetalJunction, ...] = ()
312
+ pins: dict = field(default_factory=dict) # name → MetalPin
313
+ options: dict = field(default_factory=dict) # resolved Metal options (strings, as Metal sees them)
314
+
315
+
316
+ def _shapely_polygons(geom):
317
+ gtype = geom.geom_type
318
+ if gtype == "Polygon":
319
+ return [geom]
320
+ if gtype in ("MultiPolygon", "GeometryCollection"):
321
+ return [g for part in geom.geoms for g in _shapely_polygons(part)]
322
+ return []
323
+
324
+
325
+ def _dpolygon(poly, scale: float) -> pya.DPolygon:
326
+ hull = [pya.DPoint(x * scale, y * scale) for x, y in list(poly.exterior.coords)[:-1]]
327
+ out = pya.DPolygon(hull)
328
+ for ring in poly.interiors:
329
+ out.insert_hole([pya.DPoint(x * scale, y * scale) for x, y in list(ring.coords)[:-1]])
330
+ return out
331
+
332
+
333
+ def fillet_polyline(points: list[pya.DPoint], radius: float, n: int = 64) -> list[pya.DPoint]:
334
+ """Round the interior corners of a polyline with circular arcs of ``radius`` (reduced where segments are too
335
+ short: each corner may use half of an interior segment, all of an end segment)."""
336
+ if radius <= 0 or len(points) < 3:
337
+ return list(points)
338
+ out = [points[0]]
339
+ seg = [(points[i + 1] - points[i]).length() for i in range(len(points) - 1)]
340
+ for i in range(1, len(points) - 1):
341
+ p0, p1, p2 = points[i - 1], points[i], points[i + 1]
342
+ v1, v2 = p1 - p0, p2 - p1
343
+ l1, l2 = v1.length(), v2.length()
344
+ if l1 == 0 or l2 == 0:
345
+ continue
346
+ u1, u2 = v1 / l1, v2 / l2
347
+ turn = math.atan2(u1.x * u2.y - u1.y * u2.x, u1.x * u2.x + u1.y * u2.y)
348
+ if abs(turn) < 1e-9:
349
+ out.append(p1)
350
+ continue
351
+ room1 = seg[i - 1] if i == 1 else seg[i - 1] / 2
352
+ room2 = seg[i] if i == len(points) - 2 else seg[i] / 2
353
+ t = min(radius * math.tan(abs(turn) / 2), room1, room2)
354
+ r = t / math.tan(abs(turn) / 2)
355
+ start = p1 - u1 * t
356
+ normal = pya.DVector(-u1.y, u1.x) * (1 if turn > 0 else -1)
357
+ centre = start + normal * r
358
+ a0 = math.atan2(start.y - centre.y, start.x - centre.x)
359
+ steps = max(2, int(math.ceil(abs(turn) / (2 * math.pi) * n)))
360
+ for k in range(steps + 1):
361
+ a = a0 + turn * k / steps
362
+ out.append(pya.DPoint(centre.x + r * math.cos(a), centre.y + r * math.sin(a)))
363
+ out.append(points[-1])
364
+ return out
365
+
366
+
367
+ def _path_polygon(coords, width: float, fillet: float | None, scale: float) -> pya.DPolygon:
368
+ pts = [pya.DPoint(x * scale, y * scale) for x, y in coords]
369
+ w = width * scale
370
+ # Metal's GDS renderer bends a path only when fillet >= width / 2
371
+ if fillet is not None and not math.isnan(fillet) and fillet > 0 and fillet >= 0.5 * width:
372
+ pts = fillet_polyline(pts, fillet * scale)
373
+ return pya.DPath(pts, w, 0, 0).polygon()
374
+
375
+
376
+ def _num(v) -> float | None:
377
+ try:
378
+ f = float(v)
379
+ except (TypeError, ValueError):
380
+ return None
381
+ return None if math.isnan(f) else f
382
+
383
+
384
+ @lru_cache(maxsize=512)
385
+ def metal_geometry(metal_class_ref: str, options_json: str = "{}", a: float = 10.0, b: float = 6.0) -> MetalGeometry:
386
+ """Instantiate a Metal component headless and return its geometry in µm (cached; treat the result as
387
+ read-only). ``options_json`` holds normalised options (see :func:`normalise_options`)."""
388
+ name = canonical_class_name(metal_class_ref)
389
+ cls = metal_class(name)
390
+ design = shared_design()
391
+ design.variables["cpw_width"], design.variables["cpw_gap"] = f"{a}um", f"{b}um"
392
+ options = json.loads(options_json)
393
+ options.update(pos_x="0um", pos_y="0um", orientation="0")
394
+ comp_name = f"qcc_metal_{next(_counter)}"
395
+ scale = 1000.0 if design.get_units() == "mm" else 1.0
396
+ special = SPECIAL_LAYERS.get(name.rsplit(".", 1)[-1], {})
397
+ try:
398
+ comp = cls(design, comp_name, options=options)
399
+ subtract, metal, layers, junctions = [], [], {}, []
400
+ for table_name in ("poly", "path"):
401
+ table = design.qgeometry.tables[table_name]
402
+ rows = table[table["component"] == comp.id]
403
+ for _, row in rows.iterrows():
404
+ if bool(row.get("helper", False)):
405
+ continue
406
+ fillet = _num(row.get("fillet"))
407
+ if table_name == "poly":
408
+ polys = [_dpolygon(p, scale) for p in _shapely_polygons(row.geometry)]
409
+ if fillet:
410
+ polys = [_round(p, fillet * scale) for p in polys]
411
+ else:
412
+ width = _num(row.get("width")) or 0.0
413
+ if row.geometry.geom_type != "LineString" or width <= 0:
414
+ continue
415
+ polys = [_path_polygon(list(row.geometry.coords), width, fillet, scale)]
416
+ row_name = str(row["name"])
417
+ if row_name in special:
418
+ if special[row_name] is not None:
419
+ layers.setdefault(special[row_name], []).extend(polys)
420
+ continue
421
+ (subtract if bool(row.get("subtract", False)) else metal).extend(polys)
422
+ table = design.qgeometry.tables["junction"]
423
+ for _, row in table[table["component"] == comp.id].iterrows():
424
+ if row.geometry.geom_type != "LineString":
425
+ continue
426
+ pts = tuple((x * scale, y * scale) for x, y in row.geometry.coords)
427
+ junctions.append(MetalJunction(str(row["name"]), pts, (_num(row.get("width")) or 0.0) * scale))
428
+ pins = {}
429
+ for pin_name, pin in comp.pins.items():
430
+ mid, nrm = pin["middle"], pin["normal"]
431
+ norm = math.hypot(float(nrm[0]), float(nrm[1])) or 1.0
432
+ pins[str(pin_name)] = MetalPin(
433
+ str(pin_name),
434
+ (round(float(mid[0]) * scale, 6), round(float(mid[1]) * scale, 6)),
435
+ (_snap(float(nrm[0]) / norm), _snap(float(nrm[1]) / norm)),
436
+ round(float(pin["width"]) * scale, 6),
437
+ round(float(pin["gap"]) * scale, 6),
438
+ )
439
+ resolved = _plain(comp.options)
440
+ finally:
441
+ if comp_name in design.name_to_id:
442
+ design.delete_component(comp_name)
443
+ for k in PLACEMENT_OPTIONS:
444
+ resolved.pop(k, None)
445
+ return MetalGeometry(
446
+ name,
447
+ tuple(subtract),
448
+ tuple(metal),
449
+ {k: tuple(v) for k, v in layers.items()},
450
+ tuple(junctions),
451
+ pins,
452
+ resolved,
453
+ )
454
+
455
+
456
+ def _snap(x: float) -> float:
457
+ r = round(x)
458
+ return float(r) if abs(x - r) < 1e-9 else x
459
+
460
+
461
+ def _round(poly: pya.DPolygon, radius: float) -> pya.DPolygon:
462
+ return poly.round_corners(radius, radius, 64)
File without changes