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,645 @@
1
+ """Meandered CPW resonators ported from the QWri library (fab mode): ``Coupled Resonator``, ``CPW Resonator``,
2
+ ``Qubit Resonator`` and ``Coupled Connector``.
3
+
4
+ The legacy PCells trace a centre-line polyline (horizontal runs joined by semicircular arcs of fixed arc *length*
5
+ ``arc_length``, i.e. radius ``arc_length / π``), draw it as a ``trace width`` path and etch ``negative`` = path grown
6
+ by the gap − path. Square boxes at the two ends short them to ground (box removed from the gap) or open them (box
7
+ added). The geometry here is the legacy fab output (legacy layer 1/0 with ``fab=True`` → ``base_metal_gap_wo_grid``),
8
+ computed with the same pya calls, the same int rounding and the same parameter coercion KLayout applies to the
9
+ legacy cells, so it XORs clean. Legacy 3/0 (second-metal envelope) and 10/0 (markers) are not drawn: 3/0 is derived
10
+ at mask export.
11
+
12
+ Trace width / gap are the element's ``a`` / ``b`` (legacy ``path_width`` / ``gap``), so routes inherit them; legacy
13
+ ``n`` (points per arc) is ``arc_points`` here because a KQC chip passes its own ``n`` down to its elements.
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ import math
19
+
20
+ from kqcircuits.elements.element import Element
21
+ from kqcircuits.pya_resolver import pya
22
+ from kqcircuits.util.parameters import Param, pdt
23
+
24
+
25
+ class _Pen:
26
+ """The legacy ``arc`` / ``horzPath`` / ``vertPath`` helpers (dbu, legacy rounding)."""
27
+
28
+ def __init__(self, arc_len_dbu: float, n: int):
29
+ self.arc_len, self.n = arc_len_dbu, n
30
+
31
+ def arc(self, init, flag, length, angle_begin=math.pi / 2, angle_end=3 * math.pi / 2):
32
+ """Semicircle (or the part of one of the global arc length) starting at ``init``; ``flag`` = clockwise."""
33
+ direction = -1 if flag else 1
34
+ counter = 0
35
+ current_angle = angle_begin
36
+ pts = [init]
37
+ if length < self.arc_len:
38
+ radius = self.arc_len / math.pi
39
+ angle_end = float(math.pi * length) / self.arc_len + angle_begin
40
+ else:
41
+ radius = length / math.pi
42
+ da = float((abs(angle_end) - current_angle) / self.n)
43
+ r_point = pya.Point(
44
+ pya.DPoint(init.x - (radius * math.cos(angle_begin)), init.y - (radius * math.sin(angle_begin)))
45
+ )
46
+ while counter <= self.n:
47
+ x = r_point.x + radius * math.cos(current_angle)
48
+ y = r_point.y + radius * math.sin(current_angle)
49
+ pts.append(pya.Point(pya.DPoint(x, y)))
50
+ current_angle = (current_angle + float(direction * da)) % (2 * math.pi)
51
+ counter += 1
52
+ return pts
53
+
54
+ @staticmethod
55
+ def horz(point, length, flag=True):
56
+ """Point ``length`` to the right (``flag``) or left."""
57
+ if not flag:
58
+ length = -length
59
+ return pya.Point(pya.DPoint(point.x + length, point.y))
60
+
61
+ @staticmethod
62
+ def vert(point, length, flag=True):
63
+ """Point ``length`` down (``flag``) or up."""
64
+ if flag:
65
+ length = -length
66
+ return pya.Point(pya.DPoint(point.x, point.y + length))
67
+
68
+
69
+ def _strip(dbu, pts, path_width, gap):
70
+ """(trace region, negative = trace grown by the gap − trace), as the legacy cells compute them."""
71
+ strip = pya.Region().insert(pya.Path(pts, path_width / dbu))
72
+ strip = strip.flatten()
73
+ return strip, strip.sized(gap / dbu) - strip
74
+
75
+
76
+ def _end_box_open(dbu, p, path_width, gap):
77
+ """Legacy ``finalBox`` of the coupled/qubit resonators: the gap cap below a downward tail end."""
78
+ return pya.Box(p.x - (path_width / 2 + gap) / dbu, p.y - (+gap) / dbu, p.x + (path_width / 2 + gap) / dbu, p.y)
79
+
80
+
81
+ def _square(dbu, p, half):
82
+ return pya.Box(p.x - half / dbu, p.y - half / dbu, p.x + half / dbu, p.y + half / dbu)
83
+
84
+
85
+ # ---- Coupled Resonator ------------------------------------------------------------------------------------------
86
+ def coupled_resonator_points(
87
+ dbu, cpw_len, width, arc_length, neck_length, clength, flip, tail, tail_len, tail_end, n
88
+ ) -> list:
89
+ """Legacy ``CoupledResonator.produce_impl`` centre line (dbu points). Coupler section on y = 0, meander below."""
90
+ # KLayout's coerce_parameters_impl of the legacy cell
91
+ if neck_length < arc_length:
92
+ neck_length = arc_length
93
+ if clength <= 0 or clength >= cpw_len:
94
+ clength = width
95
+ if arc_length < 50:
96
+ arc_length = 50
97
+ n = max(n, 30)
98
+
99
+ len_dbu, wid_dbu = cpw_len / dbu, width / dbu
100
+ arc_len, neck_dbu, c_length = arc_length / dbu, neck_length / dbu, clength / dbu
101
+ pen = _Pen(arc_len, n)
102
+ length = len_dbu
103
+ arc_flag = flip
104
+ radius = arc_len / math.pi
105
+
106
+ def direction(x):
107
+ return 1 if x else -1
108
+
109
+ init = pya.Point(pya.DPoint(0.0, 0.0))
110
+ pts = []
111
+ start = pya.Point(init.x - (direction(arc_flag) * c_length / 2), init.y)
112
+ if c_length >= wid_dbu:
113
+ left_arc = pen.arc(start, not arc_flag, arc_len / 2, angle_begin=math.pi / 2)
114
+ length = length - arc_len / 2
115
+ else:
116
+ left_arc = [start]
117
+ if neck_dbu > arc_len and c_length >= wid_dbu: # extra length on the non-twisted arm: half the neck
118
+ extra_neck = neck_dbu - arc_len
119
+ pts.append(pen.vert(left_arc[-1], extra_neck / 2))
120
+ length = length - (extra_neck / 2)
121
+ pts.extend(left_arc[::-1])
122
+ pts.append(pen.horz(pya.Point(init.x - (direction(arc_flag) * c_length / 2), init.y), c_length, arc_flag))
123
+ length = length - c_length
124
+ if neck_dbu > arc_len: # the neck on the twisted side
125
+ extra_neck = neck_dbu - arc_len
126
+ pts.extend(pen.arc(pts[-1], arc_flag, arc_len / 2))
127
+ pts.append(pen.vert(pts[-1], extra_neck, True))
128
+ pts.extend(pen.arc(pts[-1], arc_flag, arc_len / 2, math.pi * int(not arc_flag), -math.pi / 2))
129
+ arc_flag = not arc_flag
130
+ length = length - extra_neck - arc_len
131
+ else:
132
+ pts.extend(pen.arc(pts[-1], arc_flag, arc_len))
133
+ arc_flag = not arc_flag
134
+ length = length - arc_len
135
+
136
+ tail_dbu = 0
137
+ if tail:
138
+ tail_dbu = tail_len / dbu # the legacy "tail_calculate" switch is never set, so tail_len always applies
139
+ length = length - tail_dbu
140
+ period, lead = (wid_dbu + arc_len), (arc_len / 2 + (wid_dbu / 2 - radius))
141
+ if (length % period) > lead:
142
+ tail_dbu = length % period - lead + tail_dbu
143
+ else:
144
+ tail_dbu = length % period + period - lead + tail_dbu
145
+ length = length - period
146
+ while length - wid_dbu - arc_len >= 0:
147
+ pts.append(pen.horz(pts[-1], wid_dbu, arc_flag))
148
+ length = length - wid_dbu
149
+ pts.extend(pen.arc(pts[-1], arc_flag, arc_len))
150
+ length = length - arc_len
151
+ arc_flag = not arc_flag
152
+ if tail:
153
+ pts.append(pen.horz(pts[-1], wid_dbu / 2 - radius, arc_flag))
154
+ pts.extend(pen.arc(pts[-1], arc_flag, arc_len / 2))
155
+ if not tail_end:
156
+ pts.append(pen.vert(pts[-1], tail_dbu, True))
157
+ else:
158
+ pts.insert(0, pen.vert(pts[0], tail_dbu, True))
159
+ return pts
160
+
161
+
162
+ def resonator_end_gaps(dbu, pts, path_width, gap, cgap, ground):
163
+ """Fab gaps of the coupled / qubit resonators: the start (``pts[0]``) is shorted; the end is open with a gap
164
+ cap (``ground``) or left without one, for a connection (``ground=False``)."""
165
+ gap = 1 if gap < 0 else gap
166
+ cgap = max(cgap, 1)
167
+ _, negative = _strip(dbu, pts, path_width, gap)
168
+ init_box = _square(dbu, pts[0], path_width / 2 + gap + cgap)
169
+ final_box = _end_box_open(dbu, pts[-1], path_width, gap)
170
+ return negative - init_box + final_box if ground else negative - init_box - final_box
171
+
172
+
173
+ # ---- CPW Resonator ----------------------------------------------------------------------------------------------
174
+ def cpw_resonator_points(
175
+ dbu, cpw_len, width, arc_length, neck_length, gap, cgap, tail, tail_length, mid_tail, n
176
+ ) -> list:
177
+ """Legacy ``CPWResonator.produce_impl`` centre line (dbu points): starts at x = −(gap + cgap) on y = 0 and
178
+ meanders to +x, the first arm below."""
179
+ if neck_length < arc_length:
180
+ neck_length = arc_length
181
+ gap = 1 if gap < 0 else gap
182
+ cgap = max(cgap, 1)
183
+ arc_length = max(arc_length, 50)
184
+ tail_length = max(tail_length, arc_length)
185
+ n = max(n, 30)
186
+
187
+ len_dbu, wid_dbu = cpw_len / dbu, width / dbu
188
+ arc_path, tail_dbu, neck_dbu = arc_length / dbu, tail_length / dbu, neck_length / dbu
189
+ pen = _Pen(arc_path, n)
190
+ init = pya.Point(pya.DPoint(0.0, 0.0))
191
+ pts = [pya.Point(pya.DPoint((-gap - cgap) / dbu, 0)), init]
192
+ length = len_dbu
193
+ arc_flag = True
194
+ if tail:
195
+ length = length - tail_dbu - arc_path / 2 # reserve the tail
196
+ if (length % (wid_dbu + arc_path)) > wid_dbu:
197
+ neck_dbu = (wid_dbu + arc_path - length % (wid_dbu + arc_path)) + neck_dbu # keep the length fixed
198
+ if neck_dbu > arc_path:
199
+ length = length - neck_dbu - arc_path - wid_dbu
200
+ pts.append(pen.horz(pts[-1], wid_dbu, arc_flag))
201
+ pts.extend(pen.arc(pts[-1], arc_flag, arc_path / 2))
202
+ pts.append(pen.vert(pts[-1], neck_dbu - arc_path, True))
203
+ pts.extend(pen.arc(pts[-1], arc_flag, arc_path / 2, angle_begin=0, angle_end=-math.pi / 2))
204
+ arc_flag = not arc_flag
205
+ if mid_tail and tail:
206
+ count = int(len_dbu / (wid_dbu + arc_path))
207
+ wid_dbu = len_dbu / (count + 0.5) - arc_path
208
+ while length >= 0:
209
+ if length >= wid_dbu + arc_path:
210
+ pts.append(pen.horz(pts[-1], wid_dbu, arc_flag))
211
+ length = length - wid_dbu
212
+ pts.extend(pen.arc(pts[-1], arc_flag, arc_path))
213
+ length = length - arc_path
214
+ elif length > wid_dbu:
215
+ pts.append(pen.horz(pts[-1], wid_dbu, arc_flag))
216
+ length = length - wid_dbu
217
+ pts.append(pen.horz(pts[-1], length, arc_flag))
218
+ length = -1
219
+ else:
220
+ pts.append(pen.horz(pts[-1], length, arc_flag))
221
+ length = length - wid_dbu
222
+ arc_flag = not arc_flag
223
+ if tail:
224
+ arc_flag = not arc_flag
225
+ pts.extend(pen.arc(pts[-1], arc_flag, arc_path / 2))
226
+ pts.append(pen.vert(pts[-1], tail_dbu, True))
227
+ return pts
228
+
229
+
230
+ def cpw_resonator_gaps(dbu, pts, path_width, gap, cgap):
231
+ """Fab gaps of the CPW Resonator: both ends end on ground (no gap cap)."""
232
+ gap = 1 if gap < 0 else gap
233
+ cgap = max(cgap, 1)
234
+ final_p, init_p = pts[-1], pts[0]
235
+ final_box = _square(dbu, final_p, path_width / 2 + gap)
236
+ half = (path_width / 2 + gap + cgap) / dbu
237
+ init_box = pya.Box(init_p.x - half, init_p.y - half, init_p.x, init_p.y + half)
238
+ outer = pya.Region().insert(pya.Path(pts, path_width / dbu))
239
+ outer.flatten()
240
+ return outer.sized(gap / dbu) - outer - init_box - final_box
241
+
242
+
243
+ # ---- Qubit Resonator --------------------------------------------------------------------------------------------
244
+ def qubit_resonator_points(
245
+ dbu,
246
+ cpw_len,
247
+ width,
248
+ arc_length,
249
+ neck_length,
250
+ clength,
251
+ flip,
252
+ coupler_direction,
253
+ tail_end,
254
+ coupler_flat,
255
+ tail_conn_length,
256
+ n,
257
+ ) -> list:
258
+ """Legacy ``QubitResonator.produce_impl`` centre line (dbu points); the tail is always drawn."""
259
+ if neck_length < arc_length:
260
+ neck_length = arc_length
261
+ if clength <= 0 or clength >= cpw_len:
262
+ clength = width
263
+ arc_length = max(arc_length, 50)
264
+ n = max(n, 30)
265
+
266
+ len_dbu, wid_dbu = cpw_len / dbu, width / dbu
267
+ arc_len, neck_dbu, c_length = arc_length / dbu, neck_length / dbu, clength / dbu
268
+ pen = _Pen(arc_len, n)
269
+ length = len_dbu
270
+ arc_flag = flip
271
+ radius = arc_len / math.pi
272
+
273
+ def direction(x):
274
+ return 1 if x else -1
275
+
276
+ init = pya.Point(pya.DPoint(0.0, 0.0))
277
+ pts = []
278
+ start = pya.Point(init.x - (direction(arc_flag) * c_length / 2), init.y)
279
+ if not coupler_flat:
280
+ left_arc = pen.arc(start, not arc_flag, arc_len / 2, angle_begin=math.pi / 2)
281
+ length = length - arc_len / 2
282
+ else:
283
+ left_arc = [start]
284
+ tail_end = False # the extra tail only goes on the twisted end
285
+ if neck_dbu > arc_len and c_length >= wid_dbu + radius and not coupler_flat and not coupler_direction:
286
+ extra_neck = neck_dbu - arc_len
287
+ pts.append(pen.vert(left_arc[-1], extra_neck / 2))
288
+ length = length - (extra_neck / 2)
289
+ pts.extend(left_arc[::-1])
290
+ pts.append(pen.horz(pya.Point(init.x - (direction(arc_flag) * c_length / 2), init.y), c_length, arc_flag))
291
+ length = length - c_length
292
+ neck = list(pen.arc(pts[-1], arc_flag, arc_len / 2))
293
+ extra_neck = neck_dbu - arc_len
294
+ if extra_neck > 0:
295
+ neck.append(pen.vert(neck[-1], extra_neck, True))
296
+ length = length - extra_neck
297
+ if coupler_direction:
298
+ arc_flag = not arc_flag
299
+ neck.extend(pen.arc(neck[-1], arc_flag, arc_len / 2, math.pi * int(not arc_flag), -math.pi / 2))
300
+ length = length - arc_len
301
+ pts.extend(neck)
302
+ arc_flag = not arc_flag
303
+
304
+ tail_len = tail_conn_length / dbu
305
+ length = length - tail_len
306
+ element_len = wid_dbu + arc_len
307
+ remainder_len = length % element_len
308
+ if remainder_len > arc_len / 2 + (wid_dbu / 2 - radius):
309
+ tail_extra = remainder_len - (arc_len / 2 + (wid_dbu / 2 - radius))
310
+ else:
311
+ tail_extra = remainder_len + element_len - (arc_len / 2 + (wid_dbu / 2 - radius))
312
+ length = length - element_len
313
+ meander = [pts[-1]]
314
+ while length - wid_dbu - arc_len >= 0:
315
+ meander.append(pen.horz(meander[-1], wid_dbu, arc_flag))
316
+ length = length - wid_dbu
317
+ meander.extend(pen.arc(meander[-1], arc_flag, arc_len))
318
+ length = length - arc_len
319
+ arc_flag = not arc_flag
320
+ pts.extend(meander)
321
+ pts.append(pen.horz(pts[-1], wid_dbu / 2 - radius, arc_flag))
322
+ pts.extend(pen.arc(pts[-1], arc_flag, arc_len / 2))
323
+ pts.append(pen.vert(pts[-1], tail_len, True))
324
+ if not tail_end:
325
+ pts.append(pen.vert(pts[-1], tail_extra, True))
326
+ else:
327
+ pts.insert(0, pen.vert(pts[0], tail_extra, True))
328
+ return pts
329
+
330
+
331
+ # ---- Coupled Connector ------------------------------------------------------------------------------------------
332
+ def coupled_connector_points(dbu, cpw_len, width, arc_length, neck_length, clength, flip, n) -> list:
333
+ """Legacy ``CoupledConnector.produce_impl`` centre line (dbu points): from the origin down into a meander."""
334
+ if neck_length < arc_length:
335
+ neck_length = arc_length
336
+ if clength <= 0 or clength >= cpw_len:
337
+ clength = 500
338
+ arc_length = max(arc_length, 50)
339
+ n = max(n, 30)
340
+
341
+ len_dbu, wid_dbu = cpw_len / dbu, width / dbu
342
+ arc_len, neck_dbu, c_length = arc_length / dbu, neck_length / dbu, clength / dbu
343
+ pen = _Pen(arc_len, n)
344
+ length = len_dbu
345
+ arc_flag = flip
346
+ radius = arc_len / math.pi
347
+ init = pya.Point(pya.DPoint(0.0, 0.0))
348
+ pts = []
349
+ if neck_dbu > arc_len:
350
+ length = length - (neck_dbu - arc_len) / 2
351
+ pts.append(init)
352
+ if neck_dbu > arc_len:
353
+ length = length - (neck_dbu - arc_len) - arc_len
354
+ else:
355
+ arc_flag = not arc_flag
356
+ length = length - arc_len
357
+ # the legacy tail is always on
358
+ length = length - c_length - arc_len / 2 - arc_len - neck_dbu
359
+ if (length % (wid_dbu + arc_len)) > arc_len / 2 + (wid_dbu / 2 - radius):
360
+ tail_len = length % (wid_dbu + arc_len) - (arc_len / 2 + (wid_dbu / 2 - radius))
361
+ else:
362
+ tail_len = length % (wid_dbu + arc_len) + (wid_dbu + arc_len) - (arc_len / 2 + (wid_dbu / 2 - radius))
363
+ length = length - (wid_dbu + arc_len)
364
+ angle_begin = 0 if arc_flag else math.pi
365
+ pts.append(pen.vert(pts[-1], tail_len, True))
366
+ pts.extend(pen.arc(pts[-1], arc_flag, arc_len / 2, angle_begin=angle_begin))
367
+ pts.append(pen.horz(pts[-1], wid_dbu / 2 - radius, not arc_flag))
368
+ pts.extend(pen.arc(pts[-1], not arc_flag, arc_len))
369
+ length = length - arc_len
370
+ while length >= 0:
371
+ pts.append(pen.horz(pts[-1], wid_dbu, arc_flag))
372
+ length = length - wid_dbu
373
+ pts.extend(pen.arc(pts[-1], arc_flag, arc_len))
374
+ length = length - arc_len
375
+ arc_flag = not arc_flag
376
+ pts.append(pen.horz(pts[-1], wid_dbu / 2 - radius, arc_flag))
377
+ pts.extend(pen.arc(pts[-1], arc_flag, arc_len / 2))
378
+ pts.append(pen.vert(pts[-1], tail_len, True))
379
+ return pts
380
+
381
+
382
+ def coupled_connector_gaps(dbu, pts, path_width, gap, cgap, ground):
383
+ """Fab gaps of the Coupled Connector: start shorted; end connected (``ground``, legacy "connector side
384
+ ungrounded for a capacitor") or open with a gap box."""
385
+ gap = 1 if gap < 0 else gap
386
+ cgap = max(cgap, 1)
387
+ _, negative = _strip(dbu, pts, path_width, gap)
388
+ init_box = _square(dbu, pts[0], path_width / 2 + gap + cgap)
389
+ final_box = _square(dbu, pts[-1], path_width / 2 + gap)
390
+ return negative - init_box - final_box if ground else negative - init_box + final_box
391
+
392
+
393
+ # ---- elements ---------------------------------------------------------------------------------------------------
394
+ def _snap(x: float) -> float:
395
+ return float(round(x)) if abs(x - round(x)) < 1e-9 else x
396
+
397
+
398
+ def _end_direction(pts, at_start: bool, dbu: float) -> tuple[pya.DPoint, pya.DVector]:
399
+ """End point (µm) and outward unit direction of a polyline end (skips repeated points)."""
400
+ seq = pts if at_start else pts[::-1]
401
+ end = seq[0]
402
+ for p in seq[1:]:
403
+ if p != end:
404
+ v = pya.DVector((end.x - p.x) * dbu, (end.y - p.y) * dbu)
405
+ v = v / v.length()
406
+ return pya.DPoint(end.x * dbu, end.y * dbu), pya.DVector(_snap(v.x), _snap(v.y))
407
+ return pya.DPoint(end.x * dbu, end.y * dbu), pya.DVector(0, -1)
408
+
409
+
410
+ class _MeanderResonator(Element):
411
+ """Shared parameters of the legacy meandered resonators (µm)."""
412
+
413
+ cpw_len = Param(pdt.TypeDouble, "Length of the resonator", 4000, unit="μm")
414
+ width = Param(pdt.TypeDouble, "Meander width (straight run between arcs)", 500, unit="μm")
415
+ arc_length = Param(pdt.TypeDouble, "Arc length of a meander turn (radius = arc_length / π)", 300, unit="μm")
416
+ neck_length = Param(pdt.TypeDouble, "Neck length", 400, unit="μm")
417
+ cgap = Param(pdt.TypeDouble, "Coupling gap (ground strip around the shorted end)", 6, unit="μm")
418
+ arc_points = Param(pdt.TypeInt, "Points per arc (legacy n)", 256)
419
+
420
+ qcc_category = "resonator"
421
+ _M3_EXTRA = 0.0 # legacy 3/0: centre line grown by b + cgap + this (µm)
422
+
423
+ def _points(self) -> list:
424
+ raise NotImplementedError
425
+
426
+ def _keepout_region(self, pts) -> pya.Region:
427
+ """Legacy 3/0 (``fab_l``): the centre-line path (width a) grown by b + cgap + ``_M3_EXTRA`` (dbu)."""
428
+ dbu = self.layout.dbu
429
+ gap, cgap = (1 if self.b < 0 else self.b), max(self.cgap, 1)
430
+ strip = pya.Region().insert(pya.Path(pts, self.a / dbu))
431
+ strip.flatten()
432
+ return strip.sized(round((gap + cgap + self._M3_EXTRA) / dbu))
433
+
434
+ @classmethod
435
+ def qcc_keepout(cls, params: dict) -> list:
436
+ """3/0 keep-out (local µm): the legacy PCell's ``fab_l`` shape (:mod:`..keepout`)."""
437
+ from quantcore_circuits.layouts.others.keepout import as_cell, dpolygons # pylint: disable=C0415
438
+
439
+ obj = as_cell(cls, params)
440
+ return dpolygons(cls._keepout_region(obj, cls._points(obj)))
441
+
442
+ def _gaps(self, pts) -> pya.Region:
443
+ raise NotImplementedError
444
+
445
+ def _ports(self, pts):
446
+ dbu = self.layout.dbu
447
+ pos, d = _end_direction(pts, True, dbu)
448
+ self.refpoints["short_end"] = pos
449
+ pos, d = _end_direction(pts, False, dbu)
450
+ self.add_port("end", pos, d)
451
+
452
+ def build(self):
453
+ dbu = self.layout.dbu
454
+ pts = self._points()
455
+ gaps = self._gaps(pts)
456
+ self.cell.shapes(self.get_layer("base_metal_gap_wo_grid")).insert(gaps)
457
+ envelope = pya.Region(pya.Path(pts, self.a / dbu)).sized(self.b / dbu)
458
+ self.add_protection((envelope + gaps).merged().sized(self.margin / dbu))
459
+ self._ports(pts)
460
+
461
+
462
+ class CoupledResonator(_MeanderResonator):
463
+ """λ/4 meander resonator with a straight coupler section on y = 0 (legacy ``Coupled Resonator``); port ``end``.
464
+
465
+ The coupler runs from x = −clength/2 to +clength/2 (mirrored by ``flip``) on y = 0, the meander hangs below it.
466
+ The start next to the coupler (refpoint ``short_end``) is shorted to ground; port ``end`` is the far tail end:
467
+ open with a gap cap (``ground=True``, a hanger resonator; the cap lies *beyond* the port, so anything joined
468
+ there galvanically is cut off) or without one, to continue into a qubit claw (``ground=False``). A feedline
469
+ with the same CPW runs at y = ``a/2 + b + cgap + b + a/2`` above the coupler (refpoint ``feedline_center``), as
470
+ in the legacy chips (26 µm for 10/6/4).
471
+ """
472
+
473
+ clength = Param(pdt.TypeDouble, "Coupling length", 500, unit="μm")
474
+ ground = Param(pdt.TypeBoolean, "Open far end with a gap cap (False: end left for a connection)", True)
475
+ flip = Param(pdt.TypeBoolean, "Flip the meander direction", True)
476
+ tail = Param(pdt.TypeBoolean, "Tail", True)
477
+ tail_len = Param(pdt.TypeDouble, "Extra tail length", 0, unit="μm")
478
+ tail_end = Param(pdt.TypeBoolean, "Tail on the coupler end", False)
479
+
480
+ def _points(self):
481
+ return coupled_resonator_points(
482
+ self.layout.dbu,
483
+ self.cpw_len,
484
+ self.width,
485
+ self.arc_length,
486
+ self.neck_length,
487
+ self.clength,
488
+ self.flip,
489
+ self.tail,
490
+ self.tail_len,
491
+ self.tail_end,
492
+ self.arc_points,
493
+ )
494
+
495
+ def _gaps(self, pts):
496
+ return resonator_end_gaps(self.layout.dbu, pts, self.a, self.b, self.cgap, self.ground)
497
+
498
+ def _ports(self, pts):
499
+ super()._ports(pts)
500
+ self.refpoints["coupler_center"] = pya.DPoint(0, 0)
501
+ self.refpoints["feedline_center"] = pya.DPoint(0, self.a + 2 * self.b + max(self.cgap, 1))
502
+
503
+
504
+ class CpwResonator(_MeanderResonator):
505
+ """Meandered CPW resonator grounded at both ends (legacy ``CPW Resonator``); ports ``start`` and ``end``.
506
+
507
+ Starts at x = −(b + cgap) on y = 0 heading +x (port ``start``, facing −x), first arm below, optional neck and
508
+ tail (``tail``, ``tail_length``, ``mid_tail``). Both ends run into ground (no gap caps): ``start`` at the
509
+ centre-line start, ``end`` where the drawn gap stops, ``a/2 + b`` before the last centre-line point (the legacy
510
+ end box clears the gap there). A route joined at either port continues the conductor; left free, the end is
511
+ shorted to ground.
512
+ """
513
+
514
+ width = Param(pdt.TypeDouble, "Meander width (straight run between arcs)", 500, unit="μm")
515
+ arc_length = Param(pdt.TypeDouble, "Arc length of a meander turn (radius = arc_length / π)", 100, unit="μm")
516
+ neck_length = Param(pdt.TypeDouble, "Neck length", 100, unit="μm")
517
+ tail = Param(pdt.TypeBoolean, "Tail", False)
518
+ tail_length = Param(pdt.TypeDouble, "Tail length", 100, unit="μm")
519
+ mid_tail = Param(pdt.TypeBoolean, "Tail in the middle", False)
520
+
521
+ def _points(self):
522
+ return cpw_resonator_points(
523
+ self.layout.dbu,
524
+ self.cpw_len,
525
+ self.width,
526
+ self.arc_length,
527
+ self.neck_length,
528
+ self.b,
529
+ self.cgap,
530
+ self.tail,
531
+ self.tail_length,
532
+ self.mid_tail,
533
+ self.arc_points,
534
+ )
535
+
536
+ def _gaps(self, pts):
537
+ return cpw_resonator_gaps(self.layout.dbu, pts, self.a, self.b, self.cgap)
538
+
539
+ def _keepout_region(self, pts) -> pya.Region:
540
+ """Legacy 3/0: bbox of the simulation-mode CPW (trace + coupling ring + start box − end box) grown by
541
+ a/2 + b + 15 µm in x and 35 µm in y (``CPWResonator.lym``)."""
542
+ dbu = self.layout.dbu
543
+ gap, cgap, pw = (1 if self.b < 0 else self.b), max(self.cgap, 1), self.a
544
+ final_box = _square(dbu, pts[-1], pw / 2 + gap)
545
+ half = (pw / 2 + gap + cgap) / dbu
546
+ init_p = pts[0]
547
+ init_box = pya.Box(init_p.x - half, init_p.y - half, init_p.x, init_p.y + half)
548
+ outer = pya.Region().insert(pya.Path(pts, pw / dbu))
549
+ outer.flatten()
550
+ ring = outer.sized((gap + cgap) / dbu) - outer.sized(gap / dbu)
551
+ cpw = ring + outer + init_box - final_box
552
+ return pya.Region().insert(cpw.bbox()).sized((pw / 2 + gap + 15) / dbu, 35 / dbu, 2)
553
+
554
+ def _ports(self, pts):
555
+ dbu = self.layout.dbu
556
+ pos, d = _end_direction(pts, True, dbu)
557
+ self.add_port("start", pos, d)
558
+ pos, d = _end_direction(pts, False, dbu)
559
+ # the legacy end box (half-size a/2 + b around the last point) clears the last a/2 + b of the gap: the drawn
560
+ # CPW, and so the port, ends that far before the last centre-line point (``start`` has no such box ahead)
561
+ self.add_port("end", pos - d * (self.a / 2 + (1 if self.b < 0 else self.b)), d)
562
+
563
+
564
+ class QubitResonator(_MeanderResonator):
565
+ """λ/4 readout resonator with a coupler section and a mandatory tail to a qubit (legacy ``Qubit Resonator``).
566
+
567
+ Like :class:`CoupledResonator` (coupler on y = 0, shorted start ``short_end``, port ``end`` at the tail), plus
568
+ ``coupler_direction`` / ``coupler_flat`` variants and a fixed ``tail_conn_length`` before the computed extra tail.
569
+ ``end`` is an open end with ``ground=True`` (the gap cap lies beyond the port: nothing joined there galvanically
570
+ is connected); ``ground=False`` leaves it for a connection.
571
+ """
572
+
573
+ width = Param(pdt.TypeDouble, "Meander width (straight run between arcs)", 400, unit="μm")
574
+ cgap = Param(pdt.TypeDouble, "Coupling gap (ground strip around the shorted end)", 2, unit="μm")
575
+ clength = Param(pdt.TypeDouble, "Coupling length", 500, unit="μm")
576
+ ground = Param(pdt.TypeBoolean, "Open far end with a gap cap (False: end left for a connection)", True)
577
+ flip = Param(pdt.TypeBoolean, "Flip the meander direction", True)
578
+ coupler_direction = Param(pdt.TypeBoolean, "Coupling direction", False)
579
+ tail_end = Param(pdt.TypeBoolean, "Extra tail on the twisted end", True)
580
+ coupler_flat = Param(pdt.TypeBoolean, "Flat coupler (no arc at the coupler start)", False)
581
+ tail_conn_length = Param(pdt.TypeDouble, "Tail connection length", 100, unit="μm")
582
+
583
+ _M3_EXTRA = 7.0 # legacy: (5 + gap) + 2 + cgap
584
+
585
+ def _points(self):
586
+ return qubit_resonator_points(
587
+ self.layout.dbu,
588
+ self.cpw_len,
589
+ self.width,
590
+ self.arc_length,
591
+ self.neck_length,
592
+ self.clength,
593
+ self.flip,
594
+ self.coupler_direction,
595
+ self.tail_end,
596
+ self.coupler_flat,
597
+ self.tail_conn_length,
598
+ self.arc_points,
599
+ )
600
+
601
+ def _gaps(self, pts):
602
+ return resonator_end_gaps(self.layout.dbu, pts, self.a, self.b, self.cgap, self.ground)
603
+
604
+ def _ports(self, pts):
605
+ super()._ports(pts)
606
+ self.refpoints["coupler_center"] = pya.DPoint(0, 0)
607
+
608
+
609
+ class CoupledConnector(_MeanderResonator):
610
+ """Meandered CPW connector from the origin downwards (legacy ``Coupled Connector``); ports ``start``, ``end``.
611
+
612
+ The start (origin, facing +y) is shorted to ground; the end (facing −y) is left without a gap cap for a
613
+ connection (``ground=True``, legacy "connector side ungrounded for a capacitor") or open with a gap box
614
+ (``ground=False``, default: the box covers the port, so ``end`` cannot be joined galvanically).
615
+ """
616
+
617
+ width = Param(pdt.TypeDouble, "Meander width (straight run between arcs)", 500, unit="μm")
618
+ clength = Param(pdt.TypeDouble, "Coupling length (subtracted from the meander length)", 500, unit="μm")
619
+ ground = Param(pdt.TypeBoolean, "End left without a gap cap, for a connection", False)
620
+ flip = Param(pdt.TypeBoolean, "Flip the meander direction", True)
621
+
622
+ qcc_category = "waveguide"
623
+ _M3_EXTRA = 30.0 # legacy: (10 + gap) + 20 + cgap
624
+
625
+ def _points(self):
626
+ return coupled_connector_points(
627
+ self.layout.dbu,
628
+ self.cpw_len,
629
+ self.width,
630
+ self.arc_length,
631
+ self.neck_length,
632
+ self.clength,
633
+ self.flip,
634
+ self.arc_points,
635
+ )
636
+
637
+ def _gaps(self, pts):
638
+ return coupled_connector_gaps(self.layout.dbu, pts, self.a, self.b, self.cgap, self.ground)
639
+
640
+ def _ports(self, pts):
641
+ dbu = self.layout.dbu
642
+ pos, d = _end_direction(pts, True, dbu)
643
+ self.add_port("start", pos, d)
644
+ pos, d = _end_direction(pts, False, dbu)
645
+ self.add_port("end", pos, d)