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,469 @@
1
+ """Wafer assembly: pack square dies on a round wafer, name them, and place real chip layouts on them.
2
+
3
+ Wafer level layers (PDK): the wafer outline is on **500/0** (``wafer_boundary``) and everything else drawn at wafer
4
+ level (die labels, die outlines, alignment / orientation marks) is on **501/0** (``wafer_markers``). Chips keep their
5
+ own layers; each is a sub-cell of the wafer cell.
6
+
7
+ Units: the user-facing parameters and tables are in **mm** (a wafer is "100 mm", a die "7.5 mm"); the layout is
8
+ written in µm like every other Quantcore layout. The wafer centre is the origin, x to the right, y up.
9
+
10
+ >>> w = Wafer(diameter_mm=100, die_mm=7.5) # dense packing, notch on the bottom edge
11
+ >>> w.die_count, w.dies[0].name # doctest: +SKIP
12
+ >>> w.write("build/wafer/wafer_100.oas", chips="examples/designs/legacy/chip_06_test_cyro_tlq.json") # doctest: +SKIP
13
+
14
+ Naming: rows are letters from the top (``A``, ``B`` ... ``Z``, ``AA`` ...), columns are numbers from the left
15
+ (``1``, ``2`` ...), a die is ``<row><column>`` (``C4``). On a uniform wafer columns are counted from the leftmost
16
+ occupied column of the whole wafer, so a short top row starts at a higher number, as on a wafer map; on a mixed wafer
17
+ (``bands``) the rows do not share a grid and each row is counted from its leftmost die.
18
+
19
+ Packing:
20
+
21
+ * ``packing="dense"``: every die that fits completely inside the usable disc (wafer radius minus the edge exclusion,
22
+ and clear of the notch / flat).
23
+ * ``packing="centred"``: only dies completely inside a circle of ``radius_mm`` around the packing centre
24
+ (``offset_mm`` away from the wafer centre), and still inside the usable disc. The grid is laid out around that centre.
25
+ * ``bands=[(die_mm, n_rows), ...]`` (mixed die sizes): rows of one size stacked top to bottom, the stack centred on the
26
+ packing centre; each row is filled with as many dies as fit.
27
+ """
28
+
29
+ from __future__ import annotations
30
+
31
+ import csv
32
+ import math
33
+ import string
34
+ import tempfile
35
+ from dataclasses import dataclass, field
36
+ from pathlib import Path
37
+
38
+ from kqcircuits.pya_resolver import pya
39
+
40
+ from quantcore_circuits.pdk import QCC_LAYERS
41
+
42
+ DBU = 0.001 # µm per database unit, same as every other Quantcore layout
43
+ WAFER_LAYER = (500, 0) # PDK ``wafer_boundary``
44
+ MARKER_LAYER = (501, 0) # PDK ``wafer_markers``
45
+
46
+ #: wafer presets: diameter (mm) → (flat length mm for the "flat" orientation, name). Notch: SEMI-style V, 1 mm deep.
47
+ PRESETS = {100.0: (32.5, "4 in"), 150.0: (57.5, "6 in")}
48
+ NOTCH_DEPTH_MM = 1.0
49
+ _SIDES = {"bottom": 0.0, "right": 90.0, "top": 180.0, "left": 270.0}
50
+
51
+
52
+ def row_letters(index: int) -> str:
53
+ """0 → ``A``, 25 → ``Z``, 26 → ``AA`` (spreadsheet style)."""
54
+ out = ""
55
+ index += 1
56
+ while index:
57
+ index, rem = divmod(index - 1, 26)
58
+ out = string.ascii_uppercase[rem] + out
59
+ return out
60
+
61
+
62
+ @dataclass
63
+ class Die:
64
+ """One die position: ``name`` = row letter + column number, centre (x, y) in mm, side ``size_mm``."""
65
+
66
+ name: str
67
+ row: str
68
+ col: int
69
+ size_mm: float
70
+ x_mm: float
71
+ y_mm: float
72
+ band: int = 0
73
+ chip: str | None = None # chip id (name of the placed layout) or None for an empty die
74
+
75
+ @property
76
+ def box_um(self) -> tuple[float, float, float, float]:
77
+ h = self.size_mm * 500.0
78
+ return (self.x_mm * 1000 - h, self.y_mm * 1000 - h, self.x_mm * 1000 + h, self.y_mm * 1000 + h)
79
+
80
+
81
+ @dataclass
82
+ class Wafer:
83
+ """A wafer layout plan: the die positions and names, and :meth:`write` / :meth:`build` to draw it.
84
+
85
+ ``diameter_mm`` 100 (4 in) or 150 (6 in) are the presets; any diameter works. ``orientation`` is ``"notch"``
86
+ (default), ``"flat"`` or ``"none"`` at ``orientation_side`` (``bottom`` default). ``edge_mm`` is the edge exclusion
87
+ (no die closer than this to the rim, the notch or the flat); ``street_mm`` the dicing street between dies.
88
+ ``align``: where the die grid sits relative to the packing centre: ``"centre"`` (a die centred there), ``"corner"``
89
+ (a street crossing there), ``"row"`` / ``"column"`` (one of each) or ``"auto"`` (the one that fits most dies).
90
+ """
91
+
92
+ diameter_mm: float = 100.0
93
+ die_mm: float = 7.5
94
+ packing: str = "dense"
95
+ radius_mm: float | None = None
96
+ offset_mm: tuple[float, float] = (0.0, 0.0)
97
+ street_mm: float = 0.1
98
+ edge_mm: float = 3.0
99
+ orientation: str = "notch"
100
+ orientation_side: str = "bottom"
101
+ align: str = "auto"
102
+ bands: list[tuple[float, int]] | None = None
103
+ die_outline: bool = True
104
+ labels: bool = True
105
+ label_mm: float | None = None # label character height, default die / 12.5
106
+ name: str = ""
107
+ dies: list[Die] = field(init=False, default_factory=list)
108
+
109
+ def __post_init__(self):
110
+ if self.packing not in ("dense", "centred"):
111
+ raise ValueError(f"packing must be 'dense' or 'centred', not {self.packing!r}")
112
+ if self.packing == "centred" and not self.radius_mm:
113
+ raise ValueError("packing='centred' needs radius_mm")
114
+ if self.orientation not in ("notch", "flat", "none"):
115
+ raise ValueError("orientation must be 'notch', 'flat' or 'none'")
116
+ if self.orientation_side not in _SIDES:
117
+ raise ValueError(f"orientation_side must be one of {sorted(_SIDES)}")
118
+ if self.align not in ("auto", "centre", "corner", "row", "column"):
119
+ raise ValueError("align must be auto, centre, corner, row or column")
120
+ self.offset_mm = (float(self.offset_mm[0]), float(self.offset_mm[1]))
121
+ self.name = self.name or PRESETS.get(float(self.diameter_mm), (0, f"{self.diameter_mm:g} mm"))[1]
122
+ self._usable = self._usable_region()
123
+ self.dies = self._pack()
124
+
125
+ # ---- geometry ------------------------------------------------------------------------------------------------
126
+ @property
127
+ def radius_wafer_mm(self) -> float:
128
+ return self.diameter_mm / 2
129
+
130
+ def outline_polygon_um(self, points: int = 2000) -> pya.DPolygon:
131
+ """The wafer outline (a circle with the notch or flat cut in), in µm."""
132
+ r = self.diameter_mm * 500.0
133
+ pts: list[tuple[float, float]] = []
134
+ if self.orientation == "notch":
135
+ d = NOTCH_DEPTH_MM * 1000.0
136
+ rim = math.sqrt(r * r - d * d)
137
+ # arc from the right rim round the top to the left rim (counter-clockwise)
138
+ a_start = math.atan2(-rim, d)
139
+ a_end = math.atan2(-rim, -d) + 2 * math.pi
140
+ n = max(8, int(points * (a_end - a_start) / (2 * math.pi)))
141
+ pts = [
142
+ (r * math.cos(a_start + (a_end - a_start) * i / n), r * math.sin(a_start + (a_end - a_start) * i / n))
143
+ for i in range(n + 1)
144
+ ]
145
+ pts += [(0.0, -r + d)]
146
+ elif self.orientation == "flat":
147
+ flat = PRESETS.get(float(self.diameter_mm), (self.diameter_mm * 0.325, ""))[0] * 1000.0
148
+ half = flat / 2
149
+ y = math.sqrt(r * r - half * half)
150
+ a_start = math.atan2(-y, half)
151
+ a_end = math.atan2(-y, -half) + 2 * math.pi
152
+ n = max(8, int(points * (a_end - a_start) / (2 * math.pi)))
153
+ pts = [
154
+ (r * math.cos(a_start + (a_end - a_start) * i / n), r * math.sin(a_start + (a_end - a_start) * i / n))
155
+ for i in range(n + 1)
156
+ ]
157
+ else:
158
+ pts = [
159
+ (r * math.cos(2 * math.pi * i / points), r * math.sin(2 * math.pi * i / points)) for i in range(points)
160
+ ]
161
+ rot = math.radians(_SIDES[self.orientation_side]) if self.orientation != "none" else 0.0
162
+ c, s = math.cos(rot), math.sin(rot)
163
+ return pya.DPolygon([pya.DPoint(x * c - y * s, x * s + y * c) for x, y in pts])
164
+
165
+ def _usable_region(self) -> pya.Region:
166
+ poly = self.outline_polygon_um().to_itype(DBU)
167
+ return pya.Region(poly).sized(-int(round(self.edge_mm * 1000 / DBU)), 2)
168
+
169
+ def _fits(self, x_mm: float, y_mm: float, size_mm: float) -> bool:
170
+ h = size_mm * 500.0
171
+ box = pya.DBox(x_mm * 1000 - h, y_mm * 1000 - h, x_mm * 1000 + h, y_mm * 1000 + h)
172
+ if self.packing == "centred": # the die must lie completely inside the packing circle
173
+ ox, oy = self.offset_mm
174
+ reach = max(
175
+ math.hypot(cx / 1000 - ox, cy / 1000 - oy)
176
+ for cx in (box.left, box.right)
177
+ for cy in (box.bottom, box.top)
178
+ )
179
+ if reach > self.radius_mm + 1e-9:
180
+ return False
181
+ far = max(math.hypot(cx, cy) for cx in (box.left, box.right) for cy in (box.bottom, box.top))
182
+ if far > self.radius_wafer_mm * 1000 - self.edge_mm * 1000 + 1e-6: # outside the usable disc: quick reject
183
+ return False
184
+ return (pya.Region(box.to_itype(DBU)) - self._usable).is_empty()
185
+
186
+ # ---- packing -------------------------------------------------------------------------------------------------
187
+ def _centre(self) -> tuple[float, float]:
188
+ return self.offset_mm
189
+
190
+ def _aligns(self) -> list[str]:
191
+ return ["centre", "corner", "row", "column"] if self.align == "auto" else [self.align]
192
+
193
+ def _grid(self, align: str) -> list[tuple[int, int, float, float]]:
194
+ p = self.die_mm + self.street_mm
195
+ cx, cy = self._centre()
196
+ sx = 0.5 if align in ("corner", "column") else 0.0 # half-pitch shifts (see ``align``)
197
+ sy = 0.5 if align in ("corner", "row") else 0.0
198
+ reach = (self.radius_mm if self.packing == "centred" else self.radius_wafer_mm) + max(abs(cx), abs(cy))
199
+ n = int(reach / p) + 2
200
+ out = []
201
+ for j in range(-n, n + 1):
202
+ for i in range(-n, n + 1):
203
+ x, y = cx + (i + sx) * p, cy + (j + sy) * p
204
+ if self._fits(x, y, self.die_mm):
205
+ out.append((i, j, x, y))
206
+ return out
207
+
208
+ def _pack(self) -> list[Die]:
209
+ if self.bands:
210
+ return self._pack_bands()
211
+ best = max((self._grid(a) for a in self._aligns()), key=len) # first (centre) wins ties
212
+ return self._named([(0, self.die_mm, x, y) for _, _, x, y in best])
213
+
214
+ def _pack_bands(self) -> list[Die]:
215
+ cx, cy = self._centre()
216
+ total = sum(n * (s + self.street_mm) for s, n in self.bands) - self.street_mm
217
+ y_top = cy + total / 2
218
+ found: list[tuple[int, float, float, float]] = []
219
+ for b, (size, nrows) in enumerate(self.bands):
220
+ for _ in range(int(nrows)):
221
+ yc = y_top - size / 2
222
+ y_top -= size + self.street_mm
223
+ p = size + self.street_mm
224
+ best: list[float] = []
225
+ for shift in (0.0, 0.5):
226
+ n = int(self.radius_wafer_mm / p) + 2
227
+ xs = [cx + (i + shift) * p for i in range(-n, n + 1)]
228
+ xs = [x for x in xs if self._fits(x, yc, size)]
229
+ if len(xs) > len(best):
230
+ best = xs
231
+ found += [(b, size, x, yc) for x in best]
232
+ return self._named(found)
233
+
234
+ def _named(self, found: list[tuple[int, float, float, float]]) -> list[Die]:
235
+ """Name the dies: rows A… from the top over the occupied rows, columns 1… from the left per band."""
236
+ if not found:
237
+ return []
238
+ rows = sorted({round(y, 6) for _, _, _, y in found}, reverse=True)
239
+ letter = {y: row_letters(k) for k, y in enumerate(rows)}
240
+ first_x: dict[int, float] = {}
241
+ for b, _, x, _ in found:
242
+ first_x[b] = min(first_x.get(b, x), x)
243
+ out = []
244
+ per_row: dict[float, int] = {}
245
+ for b, size, x, y in sorted(found, key=lambda t: (-round(t[3], 6), t[2])):
246
+ p = size + self.street_mm
247
+ if self.bands: # rows of a mixed wafer do not share a grid: count from the left of each row
248
+ col = per_row[round(y, 6)] = per_row.get(round(y, 6), 0) + 1
249
+ else:
250
+ col = int(round((x - first_x[b]) / p)) + 1
251
+ row = letter[round(y, 6)]
252
+ out.append(Die(f"{row}{col}", row, col, size, round(x, 6), round(y, 6), b))
253
+ return out
254
+
255
+ # ---- results -------------------------------------------------------------------------------------------------
256
+ @property
257
+ def die_count(self) -> int:
258
+ return len(self.dies)
259
+
260
+ def counts_by_size(self) -> dict[float, int]:
261
+ out: dict[float, int] = {}
262
+ for d in self.dies:
263
+ out[d.size_mm] = out.get(d.size_mm, 0) + 1
264
+ return out
265
+
266
+ def die(self, name: str) -> Die:
267
+ for d in self.dies:
268
+ if d.name == name:
269
+ return d
270
+ raise KeyError(name)
271
+
272
+ def table(self) -> list[dict]:
273
+ """One row per die: name, row, column, size, centre (mm) and the chip placed on it."""
274
+ return [
275
+ {
276
+ "die": d.name,
277
+ "row": d.row,
278
+ "col": d.col,
279
+ "size_mm": d.size_mm,
280
+ "x_mm": d.x_mm,
281
+ "y_mm": d.y_mm,
282
+ "chip": d.chip or "",
283
+ }
284
+ for d in self.dies
285
+ ]
286
+
287
+ def table_markdown(self, limit: int | None = None) -> str:
288
+ rows = self.table()[:limit]
289
+ out = ["| die | size mm | x mm | y mm | chip |", "|---|---|---|---|---|"]
290
+ out += [f"| {r['die']} | {r['size_mm']:g} | {r['x_mm']:.3f} | {r['y_mm']:.3f} | {r['chip']} |" for r in rows]
291
+ return "\n".join(out)
292
+
293
+ def assign(self, chips) -> None:
294
+ """Set the chip id of every die from ``chips`` (see :meth:`build`) without loading any layout."""
295
+ for d in self.dies:
296
+ src = _pick(chips, d)
297
+ d.chip = None if src is None else _chip_id(src)
298
+
299
+ # ---- drawing -------------------------------------------------------------------------------------------------
300
+ def build(self, chips=None, layout: pya.Layout | None = None) -> tuple[pya.Layout, pya.Cell]:
301
+ """Draw the wafer: outline 500/0, labels / outlines / marks 501/0, the chips as sub-cells. Returns
302
+ ``(layout, top cell)``.
303
+
304
+ ``chips`` places layouts on the dies: ``None`` (empty dies), one source for every die, ``{"B3": src}`` by die
305
+ name, ``{7.5: src}`` by die size in mm (``"*"`` is the default) or a function ``die -> source | None``. A source
306
+ is a ``.json`` design (built headless), an ``.oas`` / ``.gds`` file, or a ``BuildResult``. A chip is centred
307
+ on its die; it must fit inside the die (its ``100/0`` chip boundary, or its bounding box)."""
308
+ layout = layout or pya.Layout()
309
+ layout.dbu = DBU
310
+ top = layout.create_cell(f"wafer_{self.name.replace(' ', '')}")
311
+ l_wafer = layout.layer(QCC_LAYERS["wafer_boundary"])
312
+ l_mark = layout.layer(QCC_LAYERS["wafer_markers"])
313
+ top.shapes(l_wafer).insert(self._ring())
314
+ mk = pya.Region()
315
+ for d in self.dies:
316
+ if self.die_outline:
317
+ mk += self._frame(d)
318
+ if self.labels:
319
+ mk += self._label(d)
320
+ mk += self._marks()
321
+ top.shapes(l_mark).insert(mk.merged())
322
+ cache: dict[str, tuple[pya.Cell, pya.DBox]] = {}
323
+ for d in self.dies:
324
+ src = _pick(chips, d)
325
+ d.chip = None if src is None else _chip_id(src)
326
+ if src is None:
327
+ continue
328
+ key = str(src) if isinstance(src, (str, Path)) else f"obj{id(src)}"
329
+ if key not in cache:
330
+ cache[key] = _load_chip(src, layout, f"chip_{_chip_id(src)}")
331
+ cell, box = cache[key]
332
+ if box.width() > d.size_mm * 1000 + 1e-6 or box.height() > d.size_mm * 1000 + 1e-6:
333
+ raise ValueError(
334
+ f"die {d.name}: chip {_chip_id(src)} is {box.width():g} x {box.height():g} µm, larger than the "
335
+ f"{d.size_mm:g} mm die"
336
+ )
337
+ dx, dy = d.x_mm * 1000 - box.center().x, d.y_mm * 1000 - box.center().y
338
+ top.insert(pya.DCellInstArray(cell.cell_index(), pya.DTrans(dx, dy)))
339
+ return layout, top
340
+
341
+ def write(self, path: str | Path, chips=None, table: bool = True) -> Path:
342
+ """Build and write the wafer OAS / GDS; with ``table=True`` also ``<path>.csv`` (the die table)."""
343
+ path = Path(path)
344
+ path.parent.mkdir(parents=True, exist_ok=True)
345
+ layout, top = self.build(chips)
346
+ layout.write(str(path))
347
+ if table:
348
+ self.write_table(path.with_suffix(".csv"))
349
+ return path
350
+
351
+ def write_table(self, path: str | Path) -> Path:
352
+ path = Path(path)
353
+ rows = self.table()
354
+ with open(path, "w", newline="", encoding="utf-8") as fh:
355
+ writer = csv.DictWriter(fh, fieldnames=list(rows[0]) if rows else ["die"])
356
+ writer.writeheader()
357
+ writer.writerows(rows)
358
+ return path
359
+
360
+ def plot_map(self, path: str | Path | None = None, ax=None, size_in: float = 7.0):
361
+ """Die map (matplotlib): the outline with the notch, every die with its name. Saves to ``path`` when given."""
362
+ import matplotlib.pyplot as plt # pylint: disable=import-outside-toplevel
363
+ from matplotlib.patches import Polygon, Rectangle # pylint: disable=import-outside-toplevel
364
+
365
+ fig = None
366
+ if ax is None:
367
+ fig, ax = plt.subplots(figsize=(size_in, size_in))
368
+ pts = [(p.x / 1000, p.y / 1000) for p in self.outline_polygon_um().each_point_hull()]
369
+ ax.add_patch(Polygon(pts, closed=True, fill=False, ec="#444444", lw=1.5))
370
+ for d in self.dies:
371
+ x0, y0, x1, y1 = (v / 1000 for v in d.box_um)
372
+ ax.add_patch(Rectangle((x0, y0), x1 - x0, y1 - y0, fc="#dbe7f5", ec="#2b5c8a", lw=0.8))
373
+ fs = max(4.0, 1.1 * d.size_mm * size_in / self.diameter_mm * 2.2)
374
+ ax.text(d.x_mm, d.y_mm, d.name, ha="center", va="center", fontsize=fs, color="#1b2f45")
375
+ r = self.diameter_mm / 2 * 1.02
376
+ ax.set_xlim(-r, r)
377
+ ax.set_ylim(-r, r)
378
+ ax.set_aspect("equal")
379
+ ax.set_xlabel("x (mm)")
380
+ ax.set_ylabel("y (mm)")
381
+ ax.set_title(f"{self.name} wafer, {self.die_count} dies")
382
+ if fig is not None and path is not None:
383
+ fig.savefig(path, dpi=140, bbox_inches="tight")
384
+ plt.close(fig)
385
+ return ax
386
+
387
+ # ---- pieces --------------------------------------------------------------------------------------------------
388
+ def _ring(self) -> pya.Region:
389
+ """The wafer outline on 500/0: a 200 µm ring just inside the rim (hollow, so the dies stay visible)."""
390
+ outer = pya.Region(self.outline_polygon_um().to_itype(DBU))
391
+ return (outer - outer.sized(-int(200 / DBU), 2)).merged()
392
+
393
+ def _frame(self, d: Die) -> pya.Region:
394
+ x0, y0, x1, y1 = (int(round(v / DBU)) for v in d.box_um)
395
+ w = int(round(30 / DBU))
396
+ return pya.Region(pya.Box(x0, y0, x1, y1)) - pya.Region(pya.Box(x0 + w, y0 + w, x1 - w, y1 - w))
397
+
398
+ def _label(self, d: Die) -> pya.Region:
399
+ h = (self.label_mm if self.label_mm else d.size_mm / 12.5) * 1000.0
400
+ gen = pya.TextGenerator.default_generator()
401
+ reg = gen.text(d.name, DBU, h)
402
+ bb = reg.bbox()
403
+ x0, y1 = d.box_um[0], d.box_um[3]
404
+ pad = 0.25 * h
405
+ return reg.moved(int(round((x0 + pad) / DBU)) - bb.left, int(round((y1 - pad) / DBU)) - bb.top)
406
+
407
+ def _marks(self) -> pya.Region:
408
+ """Alignment / orientation crosses on the four axis points in the edge-exclusion band (skipping the notch)."""
409
+ reg = pya.Region()
410
+ r = self.diameter_mm * 500.0
411
+ arm = min(self.edge_mm * 1000 * 0.3, 1000.0)
412
+ w = int(round(40 / DBU))
413
+ a = int(round(arm / DBU))
414
+ for side in _SIDES:
415
+ if self.orientation != "none" and side == self.orientation_side:
416
+ continue
417
+ c, s = (0, -1) if side == "bottom" else (1, 0) if side == "right" else (0, 1) if side == "top" else (-1, 0)
418
+ dist = r - self.edge_mm * 500.0
419
+ px, py = int(round(c * dist / DBU)), int(round(s * dist / DBU))
420
+ reg.insert(pya.Box(px - a, py - w // 2, px + a, py + w // 2))
421
+ reg.insert(pya.Box(px - w // 2, py - a, px + w // 2, py + a))
422
+ return reg.merged()
423
+
424
+
425
+ # ---- chips ---------------------------------------------------------------------------------------------------------
426
+ def _pick(chips, die: Die):
427
+ """The chip source for ``die`` from the ``chips`` argument of :meth:`Wafer.build`."""
428
+ if chips is None:
429
+ return None
430
+ if callable(chips) and not hasattr(chips, "layout"):
431
+ return chips(die)
432
+ if isinstance(chips, dict):
433
+ for key in (die.name, die.size_mm, float(die.size_mm), "*"):
434
+ if key in chips:
435
+ return chips[key]
436
+ return None
437
+ return chips
438
+
439
+
440
+ def _chip_id(src) -> str:
441
+ if isinstance(src, (str, Path)):
442
+ return Path(src).stem
443
+ design = getattr(src, "design", None)
444
+ return getattr(design, "name", None) or str(getattr(src, "name", "chip"))
445
+
446
+
447
+ def _load_chip(src, layout: pya.Layout, name: str) -> tuple[pya.Cell, pya.DBox]:
448
+ """Bring a chip into ``layout`` as a static cell. Returns ``(cell, box)`` where box is the chip extent in µm
449
+ (the 100/0 chip boundary when the chip has one, else everything it draws)."""
450
+ scratch = pya.Layout()
451
+ if isinstance(src, (str, Path)) and Path(src).suffix.lower() in (".oas", ".gds", ".oasis"):
452
+ scratch.read(str(src))
453
+ top = scratch.top_cells()[0]
454
+ else:
455
+ from quantcore_circuits.assembly import build, write_layout # pylint: disable=import-outside-toplevel
456
+
457
+ result = src if hasattr(src, "top") and hasattr(src, "layout") else build(src)
458
+ with tempfile.TemporaryDirectory() as folder:
459
+ path = Path(folder) / "chip.oas"
460
+ write_layout(result, path, sidecar=False)
461
+ scratch.read(str(path))
462
+ top = scratch.top_cells()[0]
463
+ li = scratch.find_layer(QCC_LAYERS["chip_boundary"])
464
+ box = top.dbbox_per_layer(li) if li is not None else pya.DBox()
465
+ if box.empty():
466
+ box = top.dbbox()
467
+ cell = layout.create_cell(name)
468
+ cell.copy_tree(top)
469
+ return cell, box
@@ -0,0 +1,6 @@
1
+ """Live view: klive client and the design file watcher."""
2
+
3
+ from quantcore_circuits.live.klive import KliveUnavailable, klive_available, send_to_klive
4
+ from quantcore_circuits.live.watch import rebuild, watch
5
+
6
+ __all__ = ["KliveUnavailable", "klive_available", "rebuild", "send_to_klive", "watch"]