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,325 @@
1
+ """``DesignChip``: a KQC ``Chip`` that executes a resolved build plan.
2
+
3
+ All decisions (snap transforms, routes, fixed lengths, parameter inheritance) are made beforehand by
4
+ :func:`quantcore_circuits.assembly.plan.plan_design`, outside the PCell. KLayout swallows exceptions raised inside
5
+ PCell code, so this
6
+ class only replays the plan; KQC's ``Chip.post_build`` then adds frame, ground grid and layer merging as usual.
7
+ """
8
+
9
+ import json
10
+
11
+ from kqcircuits.chips.chip import Chip
12
+ from kqcircuits.elements.waveguide_composite import WaveguideComposite
13
+ from kqcircuits.pya_resolver import pya
14
+ from kqcircuits.util.node import Node
15
+ from kqcircuits.util.parameters import Param, pdt
16
+
17
+ from quantcore_circuits.route.waveguide import has_corner_radii
18
+
19
+ # KQC draws each instance name with KLayout's Basic TEXT cell at magnification 400; its capital letters are 0.7 of the
20
+ # magnification tall (280 µm). ``DesignChip.instance_label_height`` sets that height.
21
+ LABEL_CAP_RATIO = 0.7
22
+ KQC_LABEL_HEIGHT = 400.0 * LABEL_CAP_RATIO
23
+
24
+
25
+ def _instance_name_labels(cell, mag: float) -> None:
26
+ """KQC's ``chip_helpers.produce_instance_name_labels`` with another magnification (same layer, placement and
27
+ upright / unmirrored rule, ``label_trans`` applied)."""
28
+ from kqcircuits.defaults import default_layers # pylint: disable=import-outside-toplevel
29
+ from kqcircuits.elements.element import insert_cell_into # pylint: disable=import-outside-toplevel
30
+
31
+ layout = cell.layout()
32
+ for inst in cell.each_inst():
33
+ inst_id = inst.property("id")
34
+ if not inst_id:
35
+ continue
36
+ label_cell = layout.create_cell("TEXT", "Basic", {"layer": default_layers["instance_names"], "text": inst_id,
37
+ "mag": float(mag)})
38
+ label_trans = inst.dcplx_trans
39
+ if 90 < label_trans.angle < 270:
40
+ label_trans.angle += 180
41
+ label_trans.mirror = False
42
+ rel = inst.property("label_trans")
43
+ if rel is not None:
44
+ label_trans = label_trans * pya.DCplxTrans.from_s(rel)
45
+ insert_cell_into(cell, label_cell, label_trans)
46
+
47
+
48
+ class DesignChip(Chip):
49
+ """Chip generated from a ``design.json`` build plan."""
50
+
51
+ qcc_category = "chip"
52
+
53
+ plan = Param(pdt.TypeString, "build plan (JSON, generated by quantcore_circuits.assembly)", "{}", hidden=True)
54
+ name_brand = Param(pdt.TypeString, "Name of the brand", "QCT") # Quantcore (2026-11-03); KQC: its own
55
+ die_frame = Param(pdt.TypeBoolean, "Quantcore die frame (PDK dicing/alignment markers, device ID)", True)
56
+ cheese = Param(
57
+ pdt.TypeString,
58
+ "Ground cheese: auto (PDK band unless the design has its own), pdk (band always), original (none added)",
59
+ "auto",
60
+ choices=["auto", "pdk", "original"],
61
+ )
62
+ device_id_side = Param(
63
+ pdt.TypeString,
64
+ "Device ID side: auto (bottom, else the first empty of top/left/right), bottom, top, left or right",
65
+ "auto",
66
+ choices=["auto", "bottom", "top", "left", "right"],
67
+ )
68
+ instance_label_height = Param(
69
+ pdt.TypeDouble,
70
+ "Height of the instance name labels (capital letters, µm; 0 = no labels; KQC: 280)",
71
+ KQC_LABEL_HEIGHT,
72
+ unit="µm",
73
+ )
74
+
75
+ def _produce_instance_name_labels(self):
76
+ """KQC's instance name labels (layer ``instance_names``, an annotation layer: not in the fab mask or the
77
+ simulations) at ``instance_label_height``. The default is KQC's own call, so a default build is unchanged."""
78
+ height = float(self.instance_label_height)
79
+ if abs(height - KQC_LABEL_HEIGHT) < 1e-9:
80
+ super()._produce_instance_name_labels()
81
+ elif height > 0:
82
+ _instance_name_labels(self.cell, height / LABEL_CAP_RATIO)
83
+
84
+ def build(self):
85
+ from quantcore_circuits.layouts.registry import resolve_cell, shape_params # pylint: disable=C0415
86
+
87
+ plan = json.loads(self.plan)
88
+ launchers = plan.get("launchers")
89
+ edge = plan.get("pad_edge") # PDK pad rule: launchers' outer edge this far from the die edge
90
+ if isinstance(launchers, dict): # named launchers: {"type", "assign": {pad number: name}, "enabled", ...}
91
+ self._produce_launcher_spec(launchers, edge)
92
+ elif launchers and edge is not None:
93
+ self._produce_launcher_spec({"type": launchers}, edge)
94
+ elif launchers:
95
+ self.produce_launchers(launchers)
96
+
97
+ pads = [] # pad / launcher footprints: device-ID anchors
98
+ placed = {} # instance name → placed instance (route joins)
99
+ for name, inst in plan.get("instances", {}).items():
100
+ trans = pya.DCplxTrans.from_s(inst["trans"])
101
+ if inst["cell"].startswith("static:"):
102
+ cell = _static_cell(self.layout, inst["cell"][len("static:") :], name)
103
+ else:
104
+ cls = resolve_cell(inst["cell"])
105
+ cell = cls.create(self.layout, library=self.LIBRARY_NAME, **shape_params(cls, inst["params"]))
106
+ if _is_pad(cls):
107
+ pads.append(cell.dbbox().transformed(trans))
108
+ placed[name], _ = self.insert_cell(cell, trans, inst_name=name, rec_levels=0)
109
+ for port in inst.get("static_ports", []):
110
+ pos = trans * pya.DPoint(*port["at"])
111
+ self.refpoints[f"{name}_port_{port['name']}"] = pos
112
+
113
+ for name, route in plan.get("routes", {}).items():
114
+ nodes = Node.nodes_from_string(route["nodes"])
115
+ cls = WaveguideComposite
116
+ if has_corner_radii(nodes): # per-corner bend radii (Waypoint.r)
117
+ from quantcore_circuits.route.waveguide import waveguide_class # pylint: disable=C0415
118
+
119
+ cls = waveguide_class(nodes)
120
+ # the cell is drawn around its first node and placed there: KQC puts a "base" refpoint at the cell origin,
121
+ # so a cell drawn in chip coordinates has a bounding box from the die origin to the route (what KLayout's
122
+ # selection shows). The offset is a whole µm, so the flattened geometry is the same.
123
+ origin = pya.DVector(round(nodes[0].position.x), round(nodes[0].position.y))
124
+ for node in nodes:
125
+ node.position = node.position - origin
126
+ cell = cls.create(self.layout, library=self.LIBRARY_NAME, nodes=nodes, **route["params"])
127
+ joined = self._join_ends(cell, nodes, route, origin, placed) if route.get("joins") else None
128
+ if joined is not None: # an end met a cell's etch across a hairline: drawn a little into the cell
129
+ cell = cls.create(self.layout, library=self.LIBRARY_NAME, nodes=joined[0], **route["params"])
130
+ self.insert_cell(cell, pya.DTrans(origin), inst_name=name)
131
+ for end, shift in (joined[1] if joined else {}).items(): # the route's ports stay at the cell's ports
132
+ for key in (f"{name}_port_{end}", f"{name}_port_{end}_corner"):
133
+ if key in self.refpoints:
134
+ self.refpoints[key] = self.refpoints[key] - shift
135
+ if f"{name}_port_{end}" in self.refpoints:
136
+ self._bridge_port_texts(self.refpoints[f"{name}_port_{end}"], shift, route["params"])
137
+
138
+ if plan.get("metal"): # extra ground (hanger couplers with narrowed facing gaps), before the cheese sees it
139
+ dbu = self.layout.dbu
140
+ layer = self.get_layer("base_metal_addition")
141
+ for pts in plan["metal"]:
142
+ self.cell.shapes(layer).insert(pya.DPolygon([pya.DPoint(*q) for q in pts]).to_itype(dbu))
143
+
144
+ if plan.get("frame"):
145
+ from quantcore_circuits.layouts.chips.frame import draw_frame # pylint: disable=import-outside-toplevel
146
+ from quantcore_circuits.pdk import DieFrame # pylint: disable=import-outside-toplevel
147
+
148
+ frame = DieFrame(**{k: tuple(v) if isinstance(v, list) else v for k, v in plan["frame"].items()})
149
+ text_layer = self.get_layer("base_metal_gap_wo_grid")
150
+ occupied = _footprints(self.cell, text_layer)
151
+ pads += _launcher_boxes(self.cell)
152
+ slot = draw_frame(
153
+ self.cell, self.box, frame, plan.get("device_id", ""), text_layer, self.device_id_side, occupied, pads
154
+ )
155
+ self._qcc_frame, self._qcc_device_id = frame, (slot if slot is not None else False)
156
+ if slot is not None:
157
+ self.refpoints["qcc_device_id_p1"], self.refpoints["qcc_device_id_p2"] = slot.p1, slot.p2
158
+ else: # optional: no room (or no name) → no ID and no keep-out
159
+ self.refpoints["qcc_device_id_none"] = self.box.p1
160
+
161
+ if plan.get("cheese"):
162
+ self._produce_pdk_cheese(plan["cheese"])
163
+
164
+ def _join_ends(self, cell, nodes, route: dict, origin, placed: dict):
165
+ """:func:`~quantcore_circuits.route.waveguide.joined_nodes` for one route of the plan (its ``joins``)."""
166
+ from kqcircuits.defaults import default_faces # pylint: disable=import-outside-toplevel
167
+
168
+ from quantcore_circuits.route.waveguide import joined_nodes # pylint: disable=import-outside-toplevel
169
+
170
+ params = route["params"]
171
+ face = (params.get("face_ids") or self.face_ids)[0]
172
+ layer = self.layout.layer(default_faces[face]["base_metal_gap_wo_grid"])
173
+ half = float(params.get("a", self.a)) / 2 + float(params.get("b", self.b))
174
+ return joined_nodes(cell, nodes, route["nodes"], origin, route["joins"], placed, layer, half)
175
+
176
+ def _bridge_port_texts(self, at, shift, params: dict) -> None:
177
+ """A joined route end's port text sits ``shift`` (:data:`~quantcore_circuits.route.waveguide.JOIN_SHIFT`)
178
+ inside the cell, away from the cell's port text at ``at``: a 2 dbu wide strip on the ports layer (an annotation
179
+ layer, not in the fab mask or the simulation) joins the two, so the netlist extraction (port texts enlarged by
180
+ 1 dbu) still sees the connection."""
181
+ from kqcircuits.defaults import default_layers # pylint: disable=import-outside-toplevel
182
+
183
+ face = (params.get("face_ids") or self.face_ids)[0]
184
+ dbu = self.layout.dbu
185
+ path = pya.DPath([at, at + shift], 2 * dbu, dbu, dbu)
186
+ self.cell.shapes(self.layout.layer(default_layers[f"{face}_ports"])).insert(path.polygon())
187
+
188
+ def _produce_pdk_cheese(self, spec: dict) -> None:
189
+ """PDK band cheese (``pdk.CheeseRule``) around the 3/0 keep-outs, drawn into ``ground_grid`` (KQC's cheese
190
+ layer, part of the 1/0 etch): inside the design area, clear of the frame markers and the device ID."""
191
+ from quantcore_circuits.layouts.chips.frame import design_area, keepouts # pylint: disable=C0415
192
+ from quantcore_circuits.layouts.wafers.fab_export import cheese_holes, etch_region, keepout_region # noqa
193
+ from quantcore_circuits.pdk import CheeseRule, get_pdk # pylint: disable=import-outside-toplevel
194
+
195
+ pdk = get_pdk(spec["pdk"])
196
+ rule = CheeseRule(**spec["rule"])
197
+ dbu = self.layout.dbu
198
+ frame = getattr(self, "_qcc_frame", None)
199
+ allowed = pya.Region((design_area(self.box, frame) if frame is not None else self.box).to_itype(dbu))
200
+ if spec.get("edge"): # the original rule keeps its holes this far from the die edge
201
+ allowed &= pya.Region(self.box.enlarged(-float(spec["edge"]), -float(spec["edge"])).to_itype(dbu))
202
+ exclude = pya.Region()
203
+ if frame is not None:
204
+ for box in keepouts(self.box, frame, getattr(self, "_qcc_device_id", None)).values():
205
+ exclude.insert(box.to_itype(dbu))
206
+ keep = keepout_region(self.cell, pdk, etch_region(self.cell, pdk.face, grid=False))
207
+ self.cell.shapes(self.get_layer("ground_grid")).insert(cheese_holes(keep, rule, dbu, allowed, exclude))
208
+
209
+ def _produce_launcher_spec(self, spec: dict, edge: float | None = None) -> None:
210
+ """Launchers from a ``design.json`` :class:`~quantcore_circuits.design.schema.Launchers` dict: a KQC preset, a
211
+ preset with overrides, or a custom set (KQC ``produce_n_launchers``; the chip keeps its own box).
212
+
213
+ ``edge`` (the PDK pad rule, ``DieFrame.pad_edge``) sets ``launcher_indent`` so each launcher's outer etch edge
214
+ is ``edge`` µm from the die edge, unless the spec gives its own ``indent``."""
215
+ from kqcircuits.defaults import default_sampleholders # pylint: disable=import-outside-toplevel
216
+
217
+ assign = {int(k): v for k, v in (spec.get("assign") or {}).items()} or None
218
+ names = {
219
+ "n": "n",
220
+ "launcher_type": "launcher_type",
221
+ "width": "launcher_width",
222
+ "gap": "launcher_gap",
223
+ "indent": "launcher_indent",
224
+ "pitch": "pad_pitch",
225
+ "frame_gap": "launcher_frame_gap",
226
+ }
227
+ overrides = {names[k]: v for k, v in spec.items() if k in names and v is not None}
228
+ kind = spec.get("type", "custom")
229
+ if not overrides and edge is None:
230
+ self.produce_launchers(kind, assign, spec.get("enabled"))
231
+ return
232
+ kw = dict(default_sampleholders.get(kind, {}))
233
+ if overrides:
234
+ kw.pop("chip_box", None) # overridden / custom launchers keep the chip's own box
235
+ if kind == "SMA8" and not assign and "n" not in overrides: # KQC produce_launchers' default SMA8 names
236
+ assign = {1: "NW", 2: "NE", 3: "EN", 4: "ES", 5: "SE", 6: "SW", 7: "WS", 8: "WN"}
237
+ if not kw and not overrides:
238
+ return # not a KQC sample holder (KQC produce_launchers draws nothing either)
239
+ kw.update(overrides)
240
+ if edge is not None and "launcher_indent" not in overrides and "launcher_width" in kw:
241
+ kw["launcher_indent"] = launcher_indent(kw, edge)
242
+ if isinstance(kw.get("n"), list):
243
+ kw["n"] = tuple(kw["n"]) # pads per side: KQC expects a tuple
244
+ kw.setdefault("launcher_type", "RF")
245
+ self.produce_n_launchers(**kw, launcher_assignments=assign, enabled=spec.get("enabled"))
246
+
247
+ def produce_ground_grid(self):
248
+ """KQC grids only faces with a KQC ChipFrame; with the PDK die frame, grid the design area instead, clear of
249
+ the marker areas and the device ID."""
250
+ frame = getattr(self, "_qcc_frame", None)
251
+ if frame is None:
252
+ super().produce_ground_grid()
253
+ return
254
+ from quantcore_circuits.layouts.chips.frame import design_area, keepouts # pylint: disable=C0415
255
+
256
+ avoid = self.cell.shapes(self.get_layer("ground_grid_avoidance"))
257
+ for box in keepouts(self.box, frame, getattr(self, "_qcc_device_id", None)).values():
258
+ avoid.insert(box)
259
+ self.produce_ground_on_face_grid(design_area(self.box, frame), 0)
260
+
261
+
262
+ def launcher_indent(kw: dict, edge: float) -> float:
263
+ """KQC ``launcher_indent`` (die edge → launcher port) that puts a launcher's outer etch edge ``edge`` µm from the
264
+ die edge: RF ``Launcher`` = taper (width) + pad (width) + frame gap; ``LauncherDC`` = half its 100 µm-wider gap
265
+ square."""
266
+ width = float(kw["launcher_width"])
267
+ if kw.get("launcher_type", "RF") == "DC":
268
+ return edge + (width + 100.0) / 2
269
+ frame_gap = kw.get("launcher_frame_gap")
270
+ frame_gap = float(kw.get("launcher_gap", 0.0) if frame_gap is None else frame_gap)
271
+ return edge + 2 * width + frame_gap
272
+
273
+
274
+ def _is_pad(cls) -> bool:
275
+ """Pads and launchers (the cells the device ID may sit beside)."""
276
+ category = getattr(cls, "qcc_category", "")
277
+ return category in ("launcher", "termination") or "Launch" in cls.__name__ or cls.__name__.endswith("Pad")
278
+
279
+
280
+ def _launcher_boxes(cell) -> list:
281
+ """Footprints of chip-frame launchers (KQC ``produce_launchers``: Launcher cells inserted into the chip)."""
282
+ layout = cell.layout()
283
+ out = []
284
+ for inst in cell.each_inst():
285
+ child = layout.cell(inst.cell_index)
286
+ if child.name.split("$", 1)[0] in ("Launcher", "Launcher DC", "LauncherDC"):
287
+ out.append(child.dbbox().transformed(inst.dcplx_trans))
288
+ return out
289
+
290
+
291
+ def _footprints(cell, gap_layer: int):
292
+ """What the device ID must avoid: each component's footprint (its etch bounding box, as the DRC uses: a pad's
293
+ interior is metal, not free space) and the etched polygons of routes (an L-shaped route's box is mostly empty)."""
294
+ occupied = pya.Region()
295
+ layout = cell.layout()
296
+ for inst in cell.each_inst():
297
+ child = layout.cell(inst.cell_index)
298
+ if child.name.startswith("Waveguide Composite"):
299
+ occupied.insert(pya.Region(child.begin_shapes_rec(gap_layer)).transformed(inst.cplx_trans))
300
+ continue
301
+ box = child.bbox_per_layer(gap_layer)
302
+ if box.empty():
303
+ box = child.bbox()
304
+ if not box.empty():
305
+ occupied.insert(box.transformed(inst.cplx_trans))
306
+ for shape in cell.shapes(gap_layer).each(): # anything drawn directly into the chip cell
307
+ occupied.insert(shape.polygon if shape.polygon is not None else shape.bbox())
308
+ return occupied
309
+
310
+
311
+ def ensure_registered():
312
+ """Make sure DesignChip (and all Quantcore cells) are registered in the KQC libraries."""
313
+ from quantcore_circuits import layouts # pylint: disable=import-outside-toplevel
314
+
315
+ layouts.ensure_loaded()
316
+
317
+
318
+ def _static_cell(layout, path, name):
319
+ """Copy the top cell of a static OAS/GDS file into ``layout``."""
320
+ src = pya.Layout()
321
+ src.read(path)
322
+ top = src.top_cell()
323
+ cell = layout.create_cell(f"static_{name}")
324
+ cell.copy_tree(top)
325
+ return cell
@@ -0,0 +1,235 @@
1
+ """Quantcore die frame (``components/pdk_geometry_summary.md``): dicing markers, alignment grids, device ID.
2
+
3
+ The frame lives inside the chip box. Its zero point is the die corner (the centre of the cross that the dicing
4
+ markers of neighbouring dies form), so every position below is measured from the nearest die corner and mirrored
5
+ for the other three corners.
6
+
7
+ * **Dicing markers** — an L in each corner, legs ``dicing_leg`` long and ``dicing_width`` wide along the die edges.
8
+ * **Design area** — the box inset by ``margin``; components belong inside it.
9
+ * **Marker areas** — ``marker_area`` squares in the four corners of the design area, each holding a 3×3 grid of
10
+ alignment squares (``grid_small`` at the corners and centre, ``grid_large`` at the edge midpoints).
11
+ * **Device ID** — a ``device_id`` block holding the chip name, centred on one side of the design area: the bottom by
12
+ default; when the chip's own geometry already occupies that spot, the first free centre of top, left, right, else
13
+ the nearest free spot slid along a side (:func:`choose_device_id`; on the left and right the block and its text are
14
+ turned 90°). The chip parameter
15
+ ``device_id_side`` (``"auto"`` default, or a fixed side) overrides the choice.
16
+
17
+ Marker areas and the device ID are keep-outs for the layout DRC (:func:`keepouts`).
18
+ """
19
+
20
+ from __future__ import annotations
21
+
22
+ from kqcircuits.pya_resolver import pya
23
+
24
+ from quantcore_circuits.pdk import QCC_LAYERS, DieFrame
25
+
26
+
27
+ def design_area(box: pya.DBox, frame: DieFrame) -> pya.DBox:
28
+ m = frame.margin
29
+ return pya.DBox(box.left + m, box.bottom + m, box.right - m, box.top - m)
30
+
31
+
32
+ def _corners(box: pya.DBox):
33
+ """(corner point, x sign, y sign) for the four die corners."""
34
+ return [
35
+ (pya.DPoint(box.left, box.bottom), 1, 1),
36
+ (pya.DPoint(box.right, box.bottom), -1, 1),
37
+ (pya.DPoint(box.left, box.top), 1, -1),
38
+ (pya.DPoint(box.right, box.top), -1, -1),
39
+ ]
40
+
41
+
42
+ def _square(cx: float, cy: float, size: float) -> pya.DBox:
43
+ return pya.DBox(cx - size / 2, cy - size / 2, cx + size / 2, cy + size / 2)
44
+
45
+
46
+ DEVICE_ID_SIDES = ("bottom", "top", "left", "right") # preference order for device_id_side="auto"
47
+
48
+
49
+ def device_id_box(box: pya.DBox, frame: DieFrame, side: str = "bottom", offset: float = 0.0) -> pya.DBox:
50
+ """The device-ID block on ``side`` of the design area, ``offset`` µm from the side's centre along it (turned 90°
51
+ on the left and right)."""
52
+ area = design_area(box, frame)
53
+ w, h = frame.device_id
54
+ c = area.center()
55
+ if side == "bottom":
56
+ return pya.DBox(c.x + offset - w / 2, area.bottom, c.x + offset + w / 2, area.bottom + h)
57
+ if side == "top":
58
+ return pya.DBox(c.x + offset - w / 2, area.top - h, c.x + offset + w / 2, area.top)
59
+ if side == "left":
60
+ return pya.DBox(area.left, c.y + offset - w / 2, area.left + h, c.y + offset + w / 2)
61
+ if side == "right":
62
+ return pya.DBox(area.right - h, c.y + offset - w / 2, area.right, c.y + offset + w / 2)
63
+ raise ValueError(f"device_id_side must be 'auto' or one of {DEVICE_ID_SIDES}, not {side!r}")
64
+
65
+
66
+ def _slide_offsets(box: pya.DBox, frame: DieFrame, side: str, step: float) -> list[float]:
67
+ """Offsets from the side's centre (0, +step, −step, +2 step, …) that keep the block between the marker areas."""
68
+ area = design_area(box, frame)
69
+ length = area.width() if side in ("bottom", "top") else area.height()
70
+ limit = length / 2 - frame.marker_area - frame.device_id[0] / 2
71
+ out, k = [], 1
72
+ while k * step <= limit + 1e-9:
73
+ out += [k * step, -k * step]
74
+ k += 1
75
+ return out
76
+
77
+
78
+ def _nearest_side(box: pya.DBox, b: pya.DBox) -> str:
79
+ gaps = {
80
+ "bottom": b.bottom - box.bottom,
81
+ "top": box.top - b.top,
82
+ "left": b.left - box.left,
83
+ "right": box.right - b.right,
84
+ }
85
+ return min(gaps, key=gaps.get)
86
+
87
+
88
+ def _beside_pads(box: pya.DBox, frame: DieFrame, anchors: list[pya.DBox], gap: float) -> list[tuple[str, float]]:
89
+ """(side, offset) of blocks ``gap`` µm beside each pad, on the die side the pad sits at (design rule: when no edge
90
+ centre is free, the ID goes left/right of the feedline pads with a 50 µm gap)."""
91
+ area = design_area(box, frame)
92
+ c, w = area.center(), frame.device_id[0]
93
+ out = []
94
+ for pad in anchors:
95
+ side = _nearest_side(box, pad)
96
+ if side in ("bottom", "top"):
97
+ out += [(side, pad.left - gap - w / 2 - c.x), (side, pad.right + gap + w / 2 - c.x)]
98
+ else:
99
+ out += [(side, pad.bottom - gap - w / 2 - c.y), (side, pad.top + gap + w / 2 - c.y)]
100
+ return out
101
+
102
+
103
+ def _within_side(box: pya.DBox, frame: DieFrame, side: str, offset: float) -> bool:
104
+ area = design_area(box, frame)
105
+ length = area.width() if side in ("bottom", "top") else area.height()
106
+ return abs(offset) <= length / 2 - frame.marker_area - frame.device_id[0] / 2 + 1e-9
107
+
108
+
109
+ def choose_device_id(
110
+ box: pya.DBox,
111
+ frame: DieFrame,
112
+ occupied: pya.Region | None,
113
+ dbu: float,
114
+ side: str = "auto",
115
+ clearance: float = 25.0,
116
+ step: float = 50.0,
117
+ anchors: list[pya.DBox] | None = None,
118
+ pad_gap: float = 50.0,
119
+ ):
120
+ """``(side, block)`` for the device ID, or ``(None, None)`` when there is no room (the ID is optional).
121
+
122
+ ``side`` fixed: centred on that side. ``"auto"`` (the user's rule): the first block that keeps ``clearance`` µm
123
+ from ``occupied`` (the chip's geometry, dbu region), trying
124
+
125
+ 1. the centre of the bottom, top, left and right side;
126
+ 2. beside the pads (``anchors``: feedline pads / launchers), ``pad_gap`` µm left or right of each;
127
+ 3. slid along the left and right edges, then the bottom and top, in ``step`` µm increments (between the corner
128
+ marker areas).
129
+
130
+ If nothing is free the chip gets no device ID (no DRC warning).
131
+ """
132
+ if side != "auto":
133
+ return side, device_id_box(box, frame, side)
134
+
135
+ def free(block: pya.DBox) -> bool:
136
+ probe = pya.Region(block.enlarged(clearance, clearance).to_itype(dbu))
137
+ return occupied.interacting(probe).is_empty()
138
+
139
+ if occupied is None:
140
+ return "bottom", device_id_box(box, frame, "bottom")
141
+ candidates = [(s, 0.0) for s in DEVICE_ID_SIDES]
142
+ candidates += [
143
+ (s, o) for s, o in _beside_pads(box, frame, anchors or [], pad_gap) if _within_side(box, frame, s, o)
144
+ ]
145
+ candidates += [(s, o) for s in ("left", "right", "bottom", "top") for o in _slide_offsets(box, frame, s, step)]
146
+ for s, o in candidates:
147
+ block = device_id_box(box, frame, s, o)
148
+ if free(block):
149
+ return s, block
150
+ return None, None
151
+
152
+
153
+ def keepouts(box: pya.DBox, frame: DieFrame, device_id: pya.DBox | None = None) -> dict[str, pya.DBox]:
154
+ """Reserved areas: the four marker areas and the device-ID block (inside the design area), and the dicing-marker
155
+ corners (in the margin). ``device_id`` is the block where the chip put it (default: the bottom position;
156
+ ``False``: the chip has no device ID)."""
157
+ area = design_area(box, frame)
158
+ a = frame.marker_area
159
+ out = {
160
+ "marker_area_sw": pya.DBox(area.left, area.bottom, area.left + a, area.bottom + a),
161
+ "marker_area_se": pya.DBox(area.right - a, area.bottom, area.right, area.bottom + a),
162
+ "marker_area_nw": pya.DBox(area.left, area.top - a, area.left + a, area.top),
163
+ "marker_area_ne": pya.DBox(area.right - a, area.top - a, area.right, area.top),
164
+ }
165
+ if device_id is not False:
166
+ out["device_id"] = device_id if device_id is not None else device_id_box(box, frame, "bottom")
167
+ leg = frame.dicing_leg
168
+ for (c, sx, sy), tag in zip(_corners(box), ("sw", "se", "nw", "ne")):
169
+ out[f"dicing_markers_{tag}"] = pya.DBox(c.x, c.y, c.x + sx * leg, c.y + sy * leg)
170
+ return out
171
+
172
+
173
+ def frame_shapes(box: pya.DBox, frame: DieFrame) -> dict[str, list[pya.DBox]]:
174
+ """Frame geometry (µm boxes) keyed by :data:`~quantcore_circuits.pdk.QCC_LAYERS` name."""
175
+ leg, w = frame.dicing_leg, frame.dicing_width
176
+ dicing, align = [], []
177
+ for c, sx, sy in _corners(box):
178
+ dicing.append(pya.DBox(c.x, c.y, c.x + sx * leg, c.y + sy * w)) # leg along the horizontal edge
179
+ dicing.append(pya.DBox(c.x, c.y, c.x + sx * w, c.y + sy * leg)) # leg along the vertical edge
180
+ for i, gx in enumerate(frame.grid_x):
181
+ for j, gy in enumerate(frame.grid_y):
182
+ size = frame.grid_large if (i == 1) != (j == 1) else frame.grid_small
183
+ align.append(_square(c.x + sx * gx, c.y + sy * gy, size))
184
+ return {frame.dicing_layer: dicing, frame.alignment_layer: align, frame.boundary_layer: [box]}
185
+
186
+
187
+ def device_id_text(slot: pya.DBox, text: str, dbu: float) -> pya.Region:
188
+ """``text`` in KLayout's default font, scaled to fit the device-ID block ``slot`` with a 10 % margin (dbu region).
189
+
190
+ A block taller than wide (left/right side) gets the text turned 90° (reading bottom to top)."""
191
+ if not text:
192
+ return pya.Region()
193
+ gen = pya.TextGenerator.default_generator()
194
+ raw = gen.text(text, dbu, 1.0)
195
+ bb = raw.bbox()
196
+ if bb.empty() or bb.width() == 0:
197
+ return pya.Region()
198
+ vertical = slot.height() > slot.width()
199
+ long_side, short_side = (slot.height(), slot.width()) if vertical else (slot.width(), slot.height())
200
+ scale = min(0.9 * long_side / (bb.width() * dbu), 0.9 * short_side / (bb.height() * dbu))
201
+ region = gen.text(text, dbu, scale)
202
+ if vertical:
203
+ region = region.transformed(pya.Trans(pya.Trans.R90))
204
+ bb = region.bbox()
205
+ target = slot.center()
206
+ shift = pya.Vector(round(target.x / dbu) - bb.center().x, round(target.y / dbu) - bb.center().y)
207
+ return region.moved(shift)
208
+
209
+
210
+ def draw_frame(
211
+ cell: pya.Cell,
212
+ box: pya.DBox,
213
+ frame: DieFrame,
214
+ text: str = "",
215
+ text_layer=None,
216
+ device_id_side: str = "auto",
217
+ occupied: pya.Region | None = None,
218
+ anchors: list[pya.DBox] | None = None,
219
+ ) -> pya.DBox | None:
220
+ """Insert the frame into ``cell``; the device-ID ``text`` goes on ``text_layer`` (a layer index).
221
+
222
+ ``occupied`` is the chip geometry already drawn and ``anchors`` the pads (for ``device_id_side="auto"``). Returns
223
+ the device-ID block used, or None: no text, or no free place (the ID is optional).
224
+ """
225
+ layout = cell.layout()
226
+ for key, boxes in frame_shapes(box, frame).items():
227
+ shapes = cell.shapes(layout.layer(QCC_LAYERS[key]))
228
+ for b in boxes:
229
+ shapes.insert(b)
230
+ if not text:
231
+ return None
232
+ _, slot = choose_device_id(box, frame, occupied, layout.dbu, device_id_side, anchors=anchors)
233
+ if slot is not None and text_layer is not None:
234
+ cell.shapes(text_layer).insert(device_id_text(slot, text, layout.dbu))
235
+ return slot
File without changes
@@ -0,0 +1,99 @@
1
+ """The two finger exposures of the QWri trilayer junctions as stand-alone cells (legacy QuantumPcells
2
+ ``JJ_finger_top.lym`` "JJ_finger Top" and ``JJ_finger_bottom.lym`` "JJ_finger Bottom").
3
+
4
+ Each is one exposure of a cross junction, not a junction by itself (category ``shape``: no ports, no LOM model);
5
+ the junctions built from them are :class:`~.trilayer.TrilayerJunction`, :class:`~.trilayer.TrilayerSquid` and the
6
+ cells in :mod:`.legacy_junctions`. They exist for test structures and hand-made junction variants, and use the
7
+ legacy parameters and frame (centred on the exposure window; with ``negative`` the cell is the window minus the
8
+ finger and its lead, as in the legacy fab output):
9
+
10
+ * :class:`JJFingerStraight` (legacy "JJ_finger Top", layer 2/0 → KQC ``SIS_junction``): pad, finger and taper;
11
+ ``invert`` flips the result vertically (legacy ``Trans(2, True)``).
12
+ * :class:`JJFingerBent` (legacy "JJ_finger Bottom", layer 4/0 → KQC ``SIS_junction_2``): the bent finger with its
13
+ holder; ``invert`` mirrors it before it is moved to ``(x, y)``.
14
+
15
+ The legacy ``coerce_parameters_impl`` rules (:func:`~.legacy_junctions.coerce_straight` /
16
+ :func:`~.legacy_junctions.coerce_bent`) are applied, as KLayout does when the parameters are set.
17
+ """
18
+
19
+ from kqcircuits.elements.element import Element
20
+ from kqcircuits.pya_resolver import pya
21
+ from kqcircuits.util.parameters import Param, pdt
22
+
23
+ from quantcore_circuits.layouts.junctions.legacy_junctions import coerce_bent, coerce_straight
24
+ from quantcore_circuits.layouts.junctions.trilayer import bent_finger, straight_finger
25
+
26
+
27
+ class _Finger(Element):
28
+ qcc_category = "shape"
29
+
30
+ finger_width = Param(pdt.TypeDouble, "Finger width (legacy finger_width)", 0.2, unit="μm")
31
+ negative = Param(pdt.TypeBoolean, "Negative: window minus finger (legacy negative / Fab)", True)
32
+ invert = Param(pdt.TypeBoolean, "Flip (legacy invert)", False)
33
+ x = Param(pdt.TypeDouble, "Finger offset in x (legacy x)", 0.0, unit="μm")
34
+
35
+ def _emit(self, region: pya.Region, layer: str):
36
+ self.cell.shapes(self.get_layer(layer)).insert(region)
37
+ if not region.is_empty():
38
+ self.add_protection(pya.Region(region.bbox()).sized(self.margin / self.layout.dbu))
39
+
40
+
41
+ class JJFingerStraight(_Finger):
42
+ """Straight junction finger (legacy "JJ_finger Top"), on ``SIS_junction`` (2/0)."""
43
+
44
+ pad_height = Param(pdt.TypeDouble, "Pad height (legacy pad_height)", 3.0, unit="μm")
45
+ pad_width = Param(pdt.TypeDouble, "Pad width (legacy pad_width)", 0.5, unit="μm")
46
+ finger_length = Param(pdt.TypeDouble, "Finger length (legacy finger_length)", 3.0, unit="μm")
47
+ window_width = Param(pdt.TypeDouble, "Window width (legacy width)", 30.0, unit="μm")
48
+ window_height = Param(pdt.TypeDouble, "Window height (legacy height)", 30.0, unit="μm")
49
+ y = Param(pdt.TypeDouble, "Finger offset in y (legacy y)", -10.0, unit="μm")
50
+
51
+ def build(self):
52
+ pad_width, pad_height = coerce_straight(self.pad_width, self.pad_height, self.finger_width)
53
+ region = straight_finger(
54
+ self.layout.dbu,
55
+ pad_width,
56
+ pad_height,
57
+ self.finger_width,
58
+ self.finger_length,
59
+ self.window_width,
60
+ self.window_height,
61
+ self.x,
62
+ self.y,
63
+ self.negative,
64
+ )
65
+ if self.invert:
66
+ region.transform(pya.Trans(2, True))
67
+ self._emit(region, "SIS_junction")
68
+
69
+
70
+ class JJFingerBent(_Finger):
71
+ """Bent junction finger with its holder (legacy "JJ_finger Bottom"), on ``SIS_junction_2`` (4/0)."""
72
+
73
+ pad_width = Param(pdt.TypeDouble, "Pad width (legacy pad_width)", 0.5, unit="μm")
74
+ conn_height = Param(pdt.TypeDouble, "Connector height (legacy conn_height)", 0.5, unit="μm")
75
+ finger_length = Param(pdt.TypeDouble, "Finger length (legacy finger_length)", 1.5, unit="μm")
76
+ window_width = Param(pdt.TypeDouble, "Window width (legacy width)", 10.0, unit="μm")
77
+ window_height = Param(pdt.TypeDouble, "Window height (legacy height)", 10.0, unit="μm")
78
+ y = Param(pdt.TypeDouble, "Finger offset in y (legacy y)", 0.0, unit="μm")
79
+
80
+ def build(self):
81
+ w, h = self.window_width, self.window_height
82
+ pad_width, conn_height, x = coerce_bent(
83
+ self.pad_width, self.conn_height, self.finger_width, self.finger_length, self.x, self.y, w, h
84
+ )
85
+ region = bent_finger(
86
+ self.layout.dbu,
87
+ pad_width,
88
+ 2, # legacy pad_height: read-only 2
89
+ self.finger_width,
90
+ self.finger_length,
91
+ conn_height,
92
+ w,
93
+ h,
94
+ x,
95
+ self.y,
96
+ self.invert,
97
+ self.negative,
98
+ )
99
+ self._emit(region, "SIS_junction_2")