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,520 @@
1
+ """Catalog of every component usable as a ``design.json`` ``cell``: Quantcore cells, KQCircuits elements and Quantum
2
+ Metal ``qlibrary`` components, each with a category.
3
+
4
+ >>> from quantcore_circuits.layouts.catalog import catalog, find
5
+ >>> [c.ref for c in catalog(category="launcher")] # BondPad, Launcher, LauncherDC, metal:Launchpad...
6
+ >>> find("TransmonPocket").ref # 'metal:TransmonPocket'
7
+ >>> find("Xmon").port_names() # ports of a default instance (built lazily)
8
+
9
+ Listing is cheap: KQC classes are imported (≈1 s), Quantum Metal classes are read from source without importing
10
+ Metal. Ports are computed on demand (:meth:`Component.ports_of`), which builds the cell (and imports Metal for
11
+ ``metal:`` entries).
12
+
13
+ ``catalog()`` lists components (``cell=True``) and, with ``chips=True``, whole KQC chips (category ``chip``; usable as
14
+ cells for reference, not as components). ``routes=True`` adds the Metal routes, which are not cells (``cell=False``;
15
+ :data:`~quantcore_circuits.layouts.metal.ROUTE_MAPPING` says which qcc route replaces each).
16
+
17
+ Catalog decisions (2026-11-15; docs/components/DUPLICATES.md): :data:`EXCLUDED` refs are not listed (they may
18
+ still resolve by ref); :data:`LEGACY` cells stay listed and placeable with a ``legacy`` reason; :data:`ALIASES` groups
19
+ cells of the same kind with the same circuit that are drawn differently (``alias_of`` / ``aliases``, a marker only:
20
+ nothing is redirected).
21
+ """
22
+
23
+ from __future__ import annotations
24
+
25
+ import importlib
26
+ import inspect
27
+ import pkgutil
28
+ import re
29
+ from dataclasses import asdict, dataclass, field
30
+ from functools import cache
31
+ from pathlib import Path
32
+
33
+ CATEGORIES = (
34
+ "qubit",
35
+ "junction",
36
+ "coupler",
37
+ "capacitor",
38
+ "resonator",
39
+ "launcher",
40
+ "termination",
41
+ "waveguide",
42
+ "airbridge",
43
+ "marker",
44
+ "test_structure",
45
+ "flip_chip",
46
+ "chip",
47
+ "shape",
48
+ "other",
49
+ )
50
+ SOURCES = ("quantcore", "kqc", "metal")
51
+
52
+ # KQC package → category; elements/ is refined by module/class name below
53
+ _KQC_PACKAGES = {
54
+ "elements": None,
55
+ "junctions": "junction",
56
+ "qubits": "qubit",
57
+ "test_structures": "test_structure",
58
+ "chips": "chip",
59
+ }
60
+ _KQC_ELEMENT_RULES = (
61
+ (r"x_coupler|capacitive_x", "coupler"),
62
+ (r"capacitor", "capacitor"),
63
+ (r"resonator", "resonator"),
64
+ (r"launcher", "launcher"),
65
+ (r"airbridge", "airbridge"),
66
+ (r"chip_frame|marker", "marker"),
67
+ (r"flip_chip|f2f|tsv|bump", "flip_chip"),
68
+ (r"waveguide|meander", "waveguide"),
69
+ (r"fluxline", "other"),
70
+ )
71
+ _QUANTCORE_FOLDERS = {"qubits": "qubit", "junctions": "junction", "chips": "chip"}
72
+
73
+ # ref → note shown in the catalog (decisions about ports that do not follow the general rules)
74
+ NOTES = {
75
+ "LauncherDC": (
76
+ "DC pad: its one port 'port' sits at the pad centre with no direction (KQC adds no corner; the square pad "
77
+ "is symmetric). Place it with at=/rot=; a route may start or end there (it leaves toward its next node); "
78
+ "it cannot be snapped to. For an RF launcher with a directed port use Launcher or BondPad."
79
+ ),
80
+ "Swissmon": (
81
+ "port 'drive' has no direction with default parameters (KQC puts no port_drive_corner). Coupler ports "
82
+ "'cplr0..2' have a = port_width[i]; the qubit's own gap around them is wider than b."
83
+ ),
84
+ "Xmon": (
85
+ "claw tails ('claw_n/w/e') start the readout CPW: their clearance is claw_tail_gap (-1 = the element b, "
86
+ "the chip CPW gap; claw_ground: claw_ground_gap) and the port declares exactly that (a = claw_tail_width); "
87
+ "the claw body keeps the claw_spacing clearance. junction_type 'Quantcore Junction' / 'Quantcore Squid' = "
88
+ "the PDK trilayer junctions; 3/0 keep-out = the legacy cross grown by 2*claw_base + 10 + claw_finger_width."
89
+ ),
90
+ "SpiralLine": (
91
+ "legacy draw.spiral (Archimedean / Fermat / double Fermat by angle; the legacy double-Fermat typo y_bls/y1s "
92
+ "fixed). Ports 'a'/'b' at the path ends face along the tangent (not Manhattan); metal by default: place it on "
93
+ "a pocket (pocket_margin, or metal:Rectangle subtract). LOM: an open-ended line of the drawn length (rough, "
94
+ "no kinetic inductance)."
95
+ ),
96
+ "ProbePadPair": (
97
+ "chip_11m's commented-out probe pads (DC test structure, no ports, no circuit model): upper pad in 1/0, "
98
+ "lower pad in the 3/0 second metal (qcc_keepout); junction_type 'Trilayer Junction Compact' puts the JX_500 "
99
+ "junction in the cut-out."
100
+ ),
101
+ "JunctionTestPads": (
102
+ "the legacy QWri test-pad block (Quantcore). KQC's test-structure factory of the same name is "
103
+ "kqcircuits.test_structures.junction_test_pads.junction_test_pads.JunctionTestPads (dotted path)."
104
+ ),
105
+ "CoupledResonator": (
106
+ "'end' is an open end: with ground=True the gap cap lies beyond the port, so anything joined there "
107
+ "galvanically is cut off (ground=False leaves the end for a connection)."
108
+ ),
109
+ "QubitResonator": (
110
+ "'end' (tail) is an open end: with ground=True the gap cap lies beyond the port, so anything joined there "
111
+ "galvanically is cut off."
112
+ ),
113
+ **{
114
+ f"metal:{name}": (
115
+ f"draws metal only, no pocket ({why}): alone it is empty in the negative mask, as in Metal's own GDS "
116
+ "(metal on the ground plane). Place it on a pocket, e.g. metal:Rectangle with subtract: true; its metal "
117
+ "goes to base_metal_addition, which the fab export removes from the etch. Metal's defaults are mm-scale."
118
+ )
119
+ for name, why in (
120
+ ("TransmonConcentricType2", "Metal leaves its pocket commented out"),
121
+ ("TunableCoupler02", "Metal computes its pocket but never adds it"),
122
+ ("ResonatorLumped", "perimeter and trace are both metal"),
123
+ ("NSquareSpiral", "a metal spiral path; LOM on a pocket: an open line of the drawn length (rough)"),
124
+ )
125
+ },
126
+ "CoupledConnector": (
127
+ "'end' is an open end with ground=False (default): the gap box covers the port, so nothing can be joined "
128
+ "galvanically; ground=True leaves the end for a connection."
129
+ ),
130
+ # cells re-implemented from QPDK (gdsfactory/quantum-rf-pdk, MIT) and SQDMetal (Apache-2.0)
131
+ "Flipmon": (
132
+ "QPDK flipmon_with_bbox (MIT). Face 2b1 (top-chip disc, its etch, the bump) is on KQC face-2b1 layers, which "
133
+ "the PDK maps to 800/0+ (flip-chip). Port 'coupler' is on the M1 etch edge, 13 µm beyond QPDK's plate port "
134
+ "o1 at defaults."
135
+ ),
136
+ "TrilayerConcentricTransmon": (
137
+ "The Quantcore copy of KQC's ConcentricTransmon (same islands, couplers, drive port, parameters, ports and "
138
+ "LOM branches) with the PDK trilayer junction: junction_type defaults to 'Quantcore Squid' (fingers 2/0 + "
139
+ "4/0, spacer 50/0, gradient 51-53/0), sized by junction_params. KQC's cell keeps its Manhattan SQUID as a "
140
+ "choice (left unset, a design draws it as the Quantcore Squid)."
141
+ ),
142
+ "Gatemon": (
143
+ "QPDK gatemon (MIT): M1 plus the CNT contacts, nanotube, hBN, Al patches and top gate on the proposed "
144
+ "layers 600-604/0 (qpdk_cells.GATEMON_LAYERS; no fab numbers yet, draw_process_layers=False for M1 "
145
+ "only). Port 'readout' is the island edge (a = island width, b = pocket_gap_top), not a CPW end: snap it to "
146
+ "GatemonCoupler.qubit."
147
+ ),
148
+ "GatemonCoupler": (
149
+ "QPDK gatemon_coupler (MIT). Port 'qubit' is a capacitive reference plane (a = island_width, b = "
150
+ "pocket_gap_top), not a CPW end: snap a Gatemon 'readout' to it."
151
+ ),
152
+ "TransmonTaperedInsets": (
153
+ "SQDMetal TransmonTaperedInsets (Apache-2.0). The corner and pocket pins keep SQDMetal's normals "
154
+ "(top_*_pin +x, bottom_*_pin +y, top_pocket_pin +x, bottom_pocket_pin -x): placement marks in or at the "
155
+ "pocket, not CPW ends. Connection-pad ports are CPW ends."
156
+ ),
157
+ "SmoothCapacitorSemicircle": (
158
+ "SQDMetal Smooth_Capacitor_Semicircle (Apache-2.0). Port 'target' is a placement reference: snap it to the "
159
+ "qubit pin (SQDMetal start_pin); routes start at 'a' (set lead_length to reach the pocket edge)."
160
+ ),
161
+ "CapacitiveXCoupler": (
162
+ "KQC draws no port refpoints, only its arm ends p11, p21, p31, p41 (KQC's own simulation ports): qcc gives "
163
+ "them as CPW ports (element a/b) facing out along each arm (registry.KQC_EXTRA_PORTS, '+': S, E, N, W; 'x': "
164
+ "the corners). LOM: each arm couples through its finger capacitor to the floating centre cross."
165
+ ),
166
+ "WaveguideCoplanarCurved": (
167
+ "origin at the arc centre: port 'a' at (r, 0), 'b' at angle alpha, both facing out along the tangent "
168
+ "(registry.KQC_EXTRA_PORTS; KQC draws no ports). LOM: a CPW line of r·|alpha|."
169
+ ),
170
+ }
171
+
172
+ # refs not offered by the catalog (design decisions); they may still resolve by ref (``registry.resolve_cell``)
173
+ EXCLUDED = {
174
+ "metal:MyQComponent": (
175
+ "an exact copy of metal:Rectangle (Metal's 'EDIT HERE' user template), used by no design or test "
176
+ "(decision 2026-11-15)"
177
+ ),
178
+ }
179
+
180
+ # legacy cells (decision 2026-11-15): kept in the catalog and placeable (existing designs and golden tests build
181
+ # them by name); ``Component.legacy`` carries the reason. New designs use the cell named in the reason.
182
+ LEGACY = {
183
+ "SpiralPath": (
184
+ "legacy spiral.lym: the archimedean curve of SpiralLine (XOR 2.4 of 155 µm²) without ports or LOM model; "
185
+ "golden test only. New designs: SpiralLine"
186
+ ),
187
+ "SquidV0": (
188
+ "pre-HSQ SQUID (no spacer); no design uses it since chip_01 moved to the PDK SQUID; golden tests only. "
189
+ "New designs: QuantcoreSquid ('Quantcore Squid')"
190
+ ),
191
+ "StripesTest": "= StripesTestIncreasingWidth with stripe_step 0 (XOR 0); unused. Use StripesTestIncreasingWidth",
192
+ "ManhattanSingleJunction": (
193
+ "KQC shadow-evaporation single junction (2/0 footprint, not the Quantcore trilayer process); unused. "
194
+ "Use QuantcoreJunction"
195
+ ),
196
+ "metal:SQUID_LOOP": "Metal 2/0 SQUID footprint without pins, not the trilayer process; unused. Use QuantcoreSquid",
197
+ "metal:BridgeFreeJunction": (
198
+ "Metal 2/0 junction footprint without pins, not the trilayer process; unused. Use QuantcoreJunction"
199
+ ),
200
+ "DoublePadsSplines": "DoublePads with spline islands (same junction and model family); unused. Use DoublePads",
201
+ "metal:NSquareSpiral": (
202
+ "Metal sample shape (metal only, no pocket); unused; the same job as metal:ResonatorCoilRect"
203
+ ),
204
+ "metal:Airbridge": "unused; routes and KQC elements draw AirbridgeRectangular (use it, or a route airbridge)",
205
+ "CapacitiveXCoupler": (
206
+ "KQC test element 'for testing FEM computations'; unused. Ports p11..p41 and a LOM model since 2026-11-15"
207
+ ),
208
+ "WaveguideCoplanarCurved": (
209
+ "the bare arc piece routes are drawn with; unused as a cell. Use a route (its bends). Ports a/b and a line "
210
+ "LOM since 2026-11-15"
211
+ ),
212
+ }
213
+
214
+ # Alias groups (decision 2026-11-15): cells of the same kind with the same circuit (equivalent LOM models for the
215
+ # same dimensions; tests/test_catalog_decisions.py) that are drawn differently (own drawing code, parameter names,
216
+ # defaults, port names, keep-out). A marker only: nothing is redirected, every ref keeps its geometry, parameters and
217
+ # ports. canonical ref → {alias ref: how its parameters and ports map onto the canonical}.
218
+ ALIASES: dict[str, dict[str, str]] = {
219
+ # the user's pairs (the LaunchpadWirebond pair is in the launch-pad group below)
220
+ "CpweOpenEnd": {
221
+ "metal:OpenToGround": "termination_gap → length, width → a, gap → b; port open → a (XOR 0 at 6 and 10 µm)",
222
+ },
223
+ "WaveguideCoplanarSplitter": {
224
+ "metal:LineTee": (
225
+ "t_length → lengths [t, t, t] with angles [0, 180, 270]; prime_end → a, prime_start → b, second_end → c "
226
+ "(XOR 0 at defaults)"
227
+ ),
228
+ },
229
+ "WaveguideCoplanarTaper": {
230
+ "CpweTaper": (
231
+ "linear profile (taper_type 0): length → taper_length, a_end → a2, b_end → b2; ports a, b (XOR 0.03 of "
232
+ "565 µm², dbu rounding). The exponential profiles 1–3 have no KQC drawing (same LOM: mean a/b)"
233
+ ),
234
+ },
235
+ # the other exact-duplicate groups of docs/components/DUPLICATES.md where the definition fits
236
+ "BondPad": { # G15: every pad is the KQC Launcher polygon with mapped parameters; all are a 50 Ω port
237
+ "metal:LaunchpadWirebond": (
238
+ "the Launcher polygon (pad_height, pad_width, taper_height → taper_length, pad_gap) + a lead_length CPW "
239
+ "lead (XOR 300 µm² = the lead); port tie → a"
240
+ ),
241
+ "metal:LaunchpadWirebondDriven": (
242
+ "= metal:LaunchpadWirebond (same options, XOR 0) + pin 'in' on the pad (the same conductor); port tie → a"
243
+ ),
244
+ "Launcher": (
245
+ "s → pad_height, l → taper_length, a_launcher → pad_width, b_launcher = launcher_frame_gap → pad_gap; "
246
+ "BondPad = the Launcher rotated 270° (XOR 0); port port → a"
247
+ ),
248
+ "ConnectorPad": (
249
+ "rounded=False = the Launcher polygon with a side gap b·pad_width/a and a back gap pad_height (no BondPad "
250
+ "parameter set matches); rounded=True has no Launcher drawing; port a. BondPad / ConnectorPad keep their "
251
+ "own 3/0 keep-out and lumped-port refpoints"
252
+ ),
253
+ "CpweBondPad": (
254
+ "taper_type 0 = the Launcher polygon rotated 180° and shifted (XOR 0); taper_type 1–3 differ; port a"
255
+ ),
256
+ },
257
+ "WaveguideCoplanar": { # G18 straight CPW
258
+ "CpwSegment": (
259
+ "length L → path [(-L/2, 0), (L/2, 0)] (CpwSegment is centred on the origin; XOR 0); ports a, b. "
260
+ "CpwSegment adds the legacy 3/0 keep-out"
261
+ ),
262
+ },
263
+ "QuantcoreJunction": { # G4: the PDK preset of TrilayerJunction
264
+ "TrilayerJunction": "finger_width 0.5, second_finger_width 0.6, clearer True = QuantcoreJunction (XOR 0)",
265
+ },
266
+ "QuantcoreSquid": { # G5: the PDK preset of TrilayerSquid
267
+ "TrilayerSquid": "finger_width 0.25, second_finger_width 0.6, clearer True = QuantcoreSquid (XOR 0)",
268
+ },
269
+ "metal:TransmonPocket": { # G1
270
+ "metal:TransmonPocket6": (
271
+ "same options; for the same connection pad set Pocket6's pad_cpw_shift 5 µm and pocket_rise 65 µm "
272
+ "(TransmonPocket's pad defaults; Pocket6's own are 0) (XOR 0); loc_W 0 adds Pocket6's middle positions"
273
+ ),
274
+ },
275
+ "metal:TransmonCross": { # G2
276
+ "metal:TransmonStar": (
277
+ "num_points 4, arm_length / arm_width / arm_gap → cross_length / cross_width / cross_gap, "
278
+ "junction_arm_index 3 (XOR 0); claws: arm_index instead of connector_location"
279
+ ),
280
+ },
281
+ "FluxHoles": {"FluxHoleArray": "the array's hole centres as FluxHoles' list (XOR 0); no circuit elements"}, # G29
282
+ "StripesTestIncreasingWidth": {"StripesTest": "stripe_step 0 (XOR 0); lithography test, no circuit"}, # G25
283
+ }
284
+
285
+
286
+ def alias_group(ref: str) -> list[str]:
287
+ """The refs of ``ref``'s alias group, canonical first ([] when ``ref`` has no aliases)."""
288
+ for canonical, members in ALIASES.items():
289
+ if ref == canonical or ref in members:
290
+ return [canonical, *members]
291
+ return []
292
+
293
+
294
+ @dataclass
295
+ class Component:
296
+ """One catalog entry. ``ref`` is what goes into ``design.json`` ``cell`` (or ``Designer.add``)."""
297
+
298
+ name: str
299
+ ref: str
300
+ source: str # quantcore | kqc | metal
301
+ category: str
302
+ module: str
303
+ description: str = ""
304
+ cell: bool = True # False: not instantiable as a cell (Metal routes)
305
+ note: str = ""
306
+ legacy: str = "" # why the cell is legacy (LEGACY); "" = current. Legacy cells stay listed and placeable
307
+ # canonical cell of its alias group (ALIASES: same circuit, drawn differently); "" = no group, or the canonical
308
+ alias_of: str = ""
309
+ aliases: list[str] = field(default_factory=list) # the other cells of its alias group (canonical included)
310
+ ports: list[str] | None = field(default=None, compare=False) # filled by catalog(ports=True) / port_names()
311
+
312
+ def resolve(self):
313
+ """The Element class of this entry."""
314
+ from quantcore_circuits.layouts.registry import resolve_cell # pylint: disable=import-outside-toplevel
315
+
316
+ if not self.cell:
317
+ raise ValueError(f"{self.ref} is not a cell: {self.note}")
318
+ return resolve_cell(self.ref)
319
+
320
+ def ports_of(self, **params) -> dict:
321
+ """Ports (``Port`` objects, local frame) of an instance with ``params`` (design.json style)."""
322
+ from quantcore_circuits.assembly.plan import pcell_params # pylint: disable=import-outside-toplevel
323
+ from quantcore_circuits.layouts.registry import element_ports # pylint: disable=import-outside-toplevel
324
+
325
+ cls = self.resolve()
326
+ return element_ports(cls, **pcell_params(cls, params))
327
+
328
+ def port_names(self) -> list[str]:
329
+ """Port names of a default instance (cached on the entry)."""
330
+ if self.ports is None:
331
+ self.ports = sorted(self.ports_of()) if self.cell else []
332
+ return self.ports
333
+
334
+ def as_dict(self) -> dict:
335
+ return {k: v for k, v in asdict(self).items() if v is not None}
336
+
337
+ def tag(self) -> str:
338
+ """Marker for listings: ``(legacy)``, ``(alias of <ref>)``, both, or ``""``."""
339
+ parts = (["legacy"] if self.legacy else []) + ([f"alias of {self.alias_of}"] if self.alias_of else [])
340
+ return f"({'; '.join(parts)})" if parts else ""
341
+
342
+ def listing_line(self) -> str:
343
+ """One line of the plain ``qcc components`` listing: ref, source, tag, description, note."""
344
+ tag = f"{self.tag()} " if self.tag() else ""
345
+ note = f" [{self.note}]" if self.note else ""
346
+ return f" {self.ref:32s} {self.source:9s} {tag}{self.description[:70]}{note}"
347
+
348
+
349
+ # ---- sources ----------------------------------------------------------------------------------------------------
350
+ def _first_line(obj) -> str:
351
+ doc = inspect.getdoc(obj) or ""
352
+ return next((ln.strip() for ln in doc.splitlines() if ln.strip()), "")[:160]
353
+
354
+
355
+ def _is_abstract(cls) -> bool:
356
+ from kqcircuits.elements.element import Element # pylint: disable=import-outside-toplevel
357
+
358
+ return cls.build is Element.build
359
+
360
+
361
+ @cache
362
+ def _quantcore() -> tuple[Component, ...]:
363
+ from quantcore_circuits import layouts # pylint: disable=import-outside-toplevel
364
+ from quantcore_circuits.layouts.metal import MetalComponent # pylint: disable=import-outside-toplevel
365
+
366
+ out = []
367
+ for cls in layouts.pcell_classes():
368
+ if issubclass(cls, MetalComponent):
369
+ continue # the generic wrapper: listed per Metal class as metal:<Class>
370
+ parts = cls.__module__.split(".")
371
+ folder = parts[2] if len(parts) > 3 else ""
372
+ category = getattr(cls, "qcc_category", None) or _QUANTCORE_FOLDERS.get(folder, "other")
373
+ out.append(Component(cls.__name__, cls.__name__, "quantcore", category, cls.__module__, _first_line(cls)))
374
+ return tuple(out)
375
+
376
+
377
+ @cache
378
+ def _kqc() -> tuple[Component, ...]:
379
+ import kqcircuits # pylint: disable=import-outside-toplevel
380
+ from kqcircuits.elements.element import Element # pylint: disable=import-outside-toplevel
381
+
382
+ base = Path(kqcircuits.__file__).parent
383
+ out, seen = [], set()
384
+ for pkg, pkg_category in _KQC_PACKAGES.items():
385
+ for info in pkgutil.walk_packages([str(base / pkg)], prefix=f"kqcircuits.{pkg}."):
386
+ try:
387
+ module = importlib.import_module(info.name)
388
+ except Exception: # noqa: BLE001 pylint: disable=broad-except
389
+ continue
390
+ for name, cls in inspect.getmembers(module, inspect.isclass):
391
+ if cls.__module__ != module.__name__ or not issubclass(cls, Element) or name in seen:
392
+ continue
393
+ if name.startswith("_") or (_is_abstract(cls) and pkg != "chips"):
394
+ continue
395
+ category = pkg_category
396
+ if category is None:
397
+ key = f"{info.name.rsplit('.', 1)[-1]} {name.lower()}"
398
+ category = next((c for pat, c in _KQC_ELEMENT_RULES if re.search(pat, key)), "other")
399
+ seen.add(name)
400
+ out.append(Component(name, name, "kqc", category, info.name, _first_line(cls)))
401
+ return tuple(out)
402
+
403
+
404
+ @cache
405
+ def _metal() -> tuple[Component, ...]:
406
+ from quantcore_circuits.layouts.metal import ROUTE_MAPPING, qlibrary_index # pylint: disable=C0415
407
+
408
+ out = []
409
+ for name, info in sorted(qlibrary_index().items()):
410
+ if info.is_route:
411
+ note = f"Metal route, not a cell: use a qcc {ROUTE_MAPPING.get(name, 'route')}"
412
+ out.append(
413
+ Component(name, f"metal:{name}", "metal", "waveguide", info.module, info.description, False, note)
414
+ )
415
+ else:
416
+ out.append(Component(name, f"metal:{name}", "metal", info.category, info.module, info.description))
417
+ return tuple(out)
418
+
419
+
420
+ _SOURCES = {"quantcore": _quantcore, "kqc": _kqc, "metal": _metal}
421
+
422
+
423
+ def catalog(
424
+ category: str | None = None,
425
+ source: str | None = None,
426
+ chips: bool = True,
427
+ routes: bool = False,
428
+ ports: bool = False,
429
+ ) -> list[Component]:
430
+ """Catalog entries (fresh copies), Quantcore first, then KQC, then Metal; each group sorted by category and name.
431
+
432
+ ``category``/``source`` filter; ``chips=False`` drops whole chips; ``routes=True`` adds the Metal routes (not
433
+ cells); ``ports=True`` also builds every entry to fill ``ports`` (slow; imports Quantum Metal).
434
+ """
435
+ if category is not None and category not in CATEGORIES:
436
+ raise ValueError(f"unknown category {category!r}; categories: {', '.join(CATEGORIES)}")
437
+ if source is not None and source not in SOURCES:
438
+ raise ValueError(f"unknown source {source!r}; sources: {', '.join(SOURCES)}")
439
+ out = []
440
+ for src in SOURCES:
441
+ if source is not None and src != source:
442
+ continue
443
+ group = [Component(**asdict(c)) for c in _SOURCES[src]() if c.ref not in EXCLUDED]
444
+ for c in group:
445
+ if c.ref in NOTES and not c.note:
446
+ c.note = NOTES[c.ref]
447
+ c.legacy = LEGACY.get(c.ref, "")
448
+ members = alias_group(c.ref)
449
+ c.alias_of = members[0] if members and members[0] != c.ref else ""
450
+ c.aliases = [m for m in members if m != c.ref]
451
+ group.sort(key=lambda c: (CATEGORIES.index(c.category), c.name.lower()))
452
+ out += group
453
+ out = [
454
+ c
455
+ for c in out
456
+ if (category is None or c.category == category) and (chips or c.category != "chip") and (routes or c.cell)
457
+ ]
458
+ if ports:
459
+ for c in out:
460
+ try:
461
+ c.port_names()
462
+ except Exception: # noqa: BLE001 pylint: disable=broad-except
463
+ c.ports = None
464
+ return out
465
+
466
+
467
+ def find(name: str) -> Component | None:
468
+ """The entry for a ref or name: exact ref, then exact name, then case-insensitive (Metal routes included)."""
469
+ entries = catalog(routes=True)
470
+ for key in (lambda c: c.ref, lambda c: c.name):
471
+ for c in entries:
472
+ if key(c) == name:
473
+ return c
474
+ low = name.lower().removeprefix("metal:")
475
+ for c in entries:
476
+ if c.name.lower() == low or c.ref.lower() == name.lower():
477
+ return c
478
+ if name.startswith("metal:"):
479
+ from quantcore_circuits.layouts.metal import find_class_info # pylint: disable=import-outside-toplevel
480
+
481
+ info = find_class_info(name[len("metal:") :])
482
+ if info is not None:
483
+ return next((c for c in entries if c.ref == f"metal:{info.name}"), None)
484
+ return None
485
+
486
+
487
+ def categories() -> dict[str, list[str]]:
488
+ """Category → refs (components and chips)."""
489
+ out: dict[str, list[str]] = {}
490
+ for c in catalog():
491
+ out.setdefault(c.category, []).append(c.ref)
492
+ return out
493
+
494
+
495
+ def listing(entries: list[Component]) -> list[str]:
496
+ """The plain ``qcc components`` listing of ``entries``: a ``<category>:`` header per category, then one
497
+ :meth:`Component.listing_line` per entry (legacy and alias cells tagged)."""
498
+ lines, current = [], None
499
+ for c in sorted(entries, key=lambda c: (c.category, c.source != "quantcore", c.ref.lower())):
500
+ if c.category != current:
501
+ current = c.category
502
+ lines.append(f"{current}:")
503
+ lines.append(c.listing_line())
504
+ return lines
505
+
506
+
507
+ __all__ = [
508
+ "ALIASES",
509
+ "CATEGORIES",
510
+ "EXCLUDED",
511
+ "LEGACY",
512
+ "NOTES",
513
+ "SOURCES",
514
+ "Component",
515
+ "alias_group",
516
+ "catalog",
517
+ "categories",
518
+ "find",
519
+ "listing",
520
+ ]
File without changes