mrdk 0.1.0__tar.gz

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 (40) hide show
  1. mrdk-0.1.0/LICENSE +202 -0
  2. mrdk-0.1.0/PKG-INFO +197 -0
  3. mrdk-0.1.0/README.md +167 -0
  4. mrdk-0.1.0/pyproject.toml +78 -0
  5. mrdk-0.1.0/pyproject.toml.orig +70 -0
  6. mrdk-0.1.0/src/mrdk/__init__.py +31 -0
  7. mrdk-0.1.0/src/mrdk/components/__init__.py +32 -0
  8. mrdk-0.1.0/src/mrdk/components/_arc_heater.py +282 -0
  9. mrdk-0.1.0/src/mrdk/components/_checks.py +94 -0
  10. mrdk-0.1.0/src/mrdk/components/_heater.py +159 -0
  11. mrdk-0.1.0/src/mrdk/components/_marker.py +36 -0
  12. mrdk-0.1.0/src/mrdk/components/chain.py +165 -0
  13. mrdk-0.1.0/src/mrdk/components/edge_coupler.py +82 -0
  14. mrdk-0.1.0/src/mrdk/components/pulley.py +181 -0
  15. mrdk-0.1.0/src/mrdk/components/resonator.py +725 -0
  16. mrdk-0.1.0/src/mrdk/components/resonator_edge.py +755 -0
  17. mrdk-0.1.0/src/mrdk/components/ring.py +245 -0
  18. mrdk-0.1.0/src/mrdk/components/ring_edge.py +492 -0
  19. mrdk-0.1.0/src/mrdk/components/ring_pcr.py +123 -0
  20. mrdk-0.1.0/src/mrdk/die/__init__.py +36 -0
  21. mrdk-0.1.0/src/mrdk/die/__main__.py +20 -0
  22. mrdk-0.1.0/src/mrdk/die/assemble.py +536 -0
  23. mrdk-0.1.0/src/mrdk/die/block.py +160 -0
  24. mrdk-0.1.0/src/mrdk/die/compare.py +106 -0
  25. mrdk-0.1.0/src/mrdk/die/device.py +186 -0
  26. mrdk-0.1.0/src/mrdk/die/edge_row.py +342 -0
  27. mrdk-0.1.0/src/mrdk/die/mask_prep.py +140 -0
  28. mrdk-0.1.0/src/mrdk/die/provenance.py +219 -0
  29. mrdk-0.1.0/src/mrdk/die/resonator_row.py +679 -0
  30. mrdk-0.1.0/src/mrdk/die/rulecheck.py +399 -0
  31. mrdk-0.1.0/src/mrdk/layer_roles.py +221 -0
  32. mrdk-0.1.0/src/mrdk/manifest/__init__.py +13 -0
  33. mrdk-0.1.0/src/mrdk/manifest/manifest.py +258 -0
  34. mrdk-0.1.0/src/mrdk/manifest/records.py +110 -0
  35. mrdk-0.1.0/src/mrdk/py.typed +0 -0
  36. mrdk-0.1.0/src/mrdk/sim/__init__.py +61 -0
  37. mrdk-0.1.0/src/mrdk/sim/coupling.py +640 -0
  38. mrdk-0.1.0/src/mrdk/sim/materials.py +101 -0
  39. mrdk-0.1.0/src/mrdk/sim/modes.py +402 -0
  40. mrdk-0.1.0/src/mrdk/sim/ring_dispersion.py +278 -0
mrdk-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
mrdk-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,197 @@
1
+ Metadata-Version: 2.4
2
+ Name: mrdk
3
+ Version: 0.1.0
4
+ Summary: MicroResonator Design Kit: physics targets -> layout -> device manifest, built on GDSFactory.
5
+ Keywords: photonics,microresonator,ring resonator,silicon nitride,integrated photonics,gdsfactory,gds,layout,pdk
6
+ Author: Nicholas Pankow
7
+ Author-email: Nicholas Pankow <pankonic@gmail.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Topic :: Scientific/Engineering :: Physics
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Typing :: Typed
18
+ Requires-Dist: gdsfactory>=9.51,<10 ; extra == 'layout'
19
+ Requires-Dist: gplugins[tidy3d,femwell,meow]>=2.1,<3 ; extra == 'sim'
20
+ Maintainer: Nicholas Pankow
21
+ Maintainer-email: Nicholas Pankow <pankonic@gmail.com>
22
+ Requires-Python: >=3.12
23
+ Project-URL: Homepage, https://github.com/pankonic/mrdk
24
+ Project-URL: Repository, https://github.com/pankonic/mrdk
25
+ Project-URL: Issues, https://github.com/pankonic/mrdk/issues
26
+ Project-URL: Changelog, https://github.com/pankonic/mrdk/blob/main/CHANGELOG.md
27
+ Provides-Extra: layout
28
+ Provides-Extra: sim
29
+ Description-Content-Type: text/markdown
30
+
31
+ # mrdk — MicroResonator Design Kit
32
+
33
+ Open-source Python library for designing on-chip microresonator chips, built on
34
+ [GDSFactory](https://gdsfactory.github.io/gdsfactory/). The flow is:
35
+ physics targets -> layout -> device manifest, with measurement analysis planned.
36
+
37
+ **Status:** beta (first public release). Components, die generators and the manifest work, and
38
+ `sim` has `mode_solve`, `dispersion` and coupling helpers. Fast circuit models (SAX) and
39
+ measurement analysis (a RingFit port) are planned for later releases — see `docs/ROADMAP.md`.
40
+
41
+ ## Install
42
+
43
+ ```bash
44
+ pip install mrdk # base: manifest only, no heavy dependencies
45
+ pip install "mrdk[layout]" # + gdsfactory: components and die
46
+ pip install "mrdk[sim]" # + gplugins: mode solving and dispersion
47
+ ```
48
+
49
+ | Install | Adds | Enables |
50
+ |---|---|---|
51
+ | `mrdk` | nothing heavy | `manifest` |
52
+ | `mrdk[layout]` | gdsfactory | `components`, `die` |
53
+ | `mrdk[sim]` | gplugins (tidy3d, femwell, meow) | `sim` |
54
+
55
+ ### Development
56
+
57
+ ```powershell
58
+ uv sync --all-extras
59
+ uv run pytest
60
+ uv run ruff check .
61
+ uv run ruff format .
62
+ ```
63
+
64
+ ## Example: edge-coupled ring die
65
+
66
+ `examples/edge_ring_die_cspdk.py` builds a die of all-pass rings on the open Cornerstone SiN PDK
67
+ (`cspdk`): rows sweep the waveguide width, rings along each row sweep the gap, some rows have
68
+ heaters. Each ring has a finite coupling bus, a taper, an S-bend and two inverse-taper edge
69
+ couplers whose facets cross the die edges into the dicing lane (`dicing_extension`, 20 µm
70
+ here), staggered so rows of rings share the edge (`mrdk.die.edge_row`). It writes the GDS and
71
+ the device manifest (CSV and JSON).
72
+
73
+ ```powershell
74
+ uv sync --all-extras
75
+ uv run python examples/edge_ring_die_cspdk.py # writes to examples/_out
76
+ ```
77
+
78
+ `cspdk` is a development dependency of this repo (installed by `uv sync`), not part of the
79
+ `mrdk[layout]` extra: outside this repo, install it yourself (`pip install cspdk`).
80
+
81
+ Rows can have arc heaters (`heater=True`) and photonic-crystal rings (`pcr_n_periods`, per ring).
82
+
83
+ Resonantly-coupled systems (a resonant coupler feeding a nonlinear resonator, after Zhu et al.,
84
+ 2026) are built with `mrdk.components.resonator_chain`: a vertical stack of `Resonator`s between
85
+ an input bus and an output bus with a tapered end, each end ring with its own heater (see
86
+ `docs/design/coupled_resonators.md`). `mrdk.components.resonator_edge` routes such a system to
87
+ an input facet and to through and comb-output facets, and `mrdk.die.resonator_row` lays them
88
+ out in rows sweeping the gap between the two resonators. `examples/rc_nr_die_cspdk.py` builds a
89
+ two-row example die (straight and pulley input buses):
90
+
91
+ ```powershell
92
+ uv run python examples/rc_nr_die_cspdk.py # writes RCNR1.gds and its manifest
93
+ ```
94
+
95
+ To check a rebuild against an existing GDS (for example in a private tape-out repo that has
96
+ the real PDK), `mrdk.die.gds_xor(reference, rebuild)` XORs two files layer by layer; the recipe
97
+ is in `docs/design/parity_check.md`.
98
+
99
+ The building blocks, all in µm:
100
+
101
+ ```python
102
+ import mrdk
103
+ from cspdk.sin300 import PDK
104
+ from mrdk.components import ring_allpass
105
+ from mrdk.die import assemble, sweep_block
106
+
107
+ mrdk.activate_pdk(PDK) # use this instead of PDK.activate() when switching PDKs
108
+ block = sweep_block(
109
+ ring_allpass,
110
+ die="D1",
111
+ row_param="width",
112
+ row_values=[1.2, 1.4],
113
+ ring_param="gap",
114
+ ring_values=[0.3, 0.4, 0.5],
115
+ component_kwargs={"radius": 100},
116
+ )
117
+ die, manifest = assemble([block], die="D1", die_size=(5000, 5000), gds_path="D1.gds")
118
+ ```
119
+
120
+ What `assemble` draws on the die, by layer role: the chip outline on `floorplan` (all four
121
+ sides), the printed die name and the corner alignment crosses on `label_text`, a layer the foundry
122
+ patterns. The cspdk preset prints text in the nitride core (`NITRIDE`), because cspdk has no
123
+ patterned text layer, and keeps GDS text labels for tools on `LBL` (`label_info`).
124
+
125
+ By default `assemble` stacks the blocks upwards. To place them yourself, pass
126
+ `positions=[(x, y), mrdk.die.Placement(x, y, rotation=90, mirror=True), ...]`: the lower-left
127
+ corner of each block's footprint in die coordinates (µm). It replaces `inset`, `inset_x` and
128
+ `block_gap`, and checks overlap (`min_block_gap`), the outline, the alignment marks and the die
129
+ label; edge-coupled blocks need `x=0`, the full die width and no rotation. See the `assemble`
130
+ docstring.
131
+
132
+ Foundry layers, rules and cells always come from the PDK you activate; mrdk never hard-codes
133
+ them. `mrdk.die.check` runs a design-time rule check against a table you fill in from your
134
+ foundry's manual (the numbers below are made up), and the foundry's own DRC deck can be hooked
135
+ in with `assemble(..., drc=callable)`:
136
+
137
+ ```python
138
+ from mrdk.die import LayerRules, Rules, check
139
+
140
+ rules = Rules(layers={"NITRIDE": LayerRules(min_width=0.15, min_space=0.5, outside_outline=20)})
141
+ report = check("Die2_edge.gds", rules)
142
+ print(report.summary())
143
+ report.write_lyrdb("Die2_edge.lyrdb") # open in KLayout's marker browser
144
+ # or: assemble(..., gds_path=..., check=rules) raises on violations, writes the .lyrdb
145
+ ```
146
+
147
+ Other checks built into the components: rings smaller than the cross-section's minimum bend
148
+ radius are rejected, `min_feature=` on `edge_coupler`/`ring_edge` rejects narrower waveguides,
149
+ heater pads must clear every waveguide by `pad_clearance` (5 µm), and `die.device(...,
150
+ fiber_pitch=127)` spaces the two gratings by a whole number of fibre-array channels.
151
+
152
+ ## Simulation (v0.2, in progress)
153
+
154
+ `mrdk.sim.mode_solve` gives the guided modes of a waveguide of the active PDK (femwell finite
155
+ elements through gplugins, runs locally in a few seconds; needs the `sim` extra):
156
+
157
+ ```python
158
+ import mrdk
159
+ from cspdk.sin300 import PDK
160
+ from mrdk.sim import mode_solve
161
+
162
+ mrdk.activate_pdk(PDK)
163
+ result = mode_solve(1.5) # 1.5 um wide nitride guide at 1.55 um
164
+ print(result.fundamental_te.n_eff) # about 1.619 (cspdk has no cladding: oxide is assumed)
165
+ print(mode_solve(1.5, radius_um=237).fundamental_te.n_eff) # bent, referred to the centre
166
+ ```
167
+
168
+ `mrdk.sim.dispersion` sweeps the bent ring's TE0 mode over wavelength and gives n_g, FSR, D2 and
169
+ the integrated dispersion D_int (frequencies in Hz; about 4 s per wavelength). The numpy part,
170
+ `dispersion_from_neff(wavelengths_um, n_eff, length_um)`, also takes your own n_eff data:
171
+
172
+ ```python
173
+ import numpy as np
174
+ from mrdk.sim import dispersion
175
+
176
+ d = dispersion(1.5, 237.0, np.linspace(1.50, 1.60, 6), pump_wavelength_um=1.55)
177
+ print(d.pump_fsr_hz / 1e9, d.pump_d2_hz / 1e6) # about 101.7 GHz and -9.7 MHz (normal)
178
+ ```
179
+
180
+ ## Check a GDS against its manifest
181
+
182
+ `assemble` records the mrdk version, a hash of the design, the build time and the GDS file name
183
+ in the manifest (the GDS itself carries no version or hash text). Before measuring, check that
184
+ a GDS and a manifest belong together: the die name and every device's printed facet labels must
185
+ be in the GDS at the facet positions of the manifest (needs the `layout` extra, no PDK):
186
+
187
+ ```powershell
188
+ uv run python -m mrdk.die verify examples/_out/Die2_edge.gds examples/_out/Die2_edge_manifest.csv
189
+ ```
190
+
191
+ It prints `OK` (exit code 0) or the mismatches (exit code 1): another design, a manifest
192
+ edited after it was written, or the die name or device labels missing from the GDS (or not at
193
+ their facets, or a different number of them).
194
+
195
+ ## License
196
+
197
+ Apache-2.0. See [LICENSE](LICENSE).
mrdk-0.1.0/README.md ADDED
@@ -0,0 +1,167 @@
1
+ # mrdk — MicroResonator Design Kit
2
+
3
+ Open-source Python library for designing on-chip microresonator chips, built on
4
+ [GDSFactory](https://gdsfactory.github.io/gdsfactory/). The flow is:
5
+ physics targets -> layout -> device manifest, with measurement analysis planned.
6
+
7
+ **Status:** beta (first public release). Components, die generators and the manifest work, and
8
+ `sim` has `mode_solve`, `dispersion` and coupling helpers. Fast circuit models (SAX) and
9
+ measurement analysis (a RingFit port) are planned for later releases — see `docs/ROADMAP.md`.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ pip install mrdk # base: manifest only, no heavy dependencies
15
+ pip install "mrdk[layout]" # + gdsfactory: components and die
16
+ pip install "mrdk[sim]" # + gplugins: mode solving and dispersion
17
+ ```
18
+
19
+ | Install | Adds | Enables |
20
+ |---|---|---|
21
+ | `mrdk` | nothing heavy | `manifest` |
22
+ | `mrdk[layout]` | gdsfactory | `components`, `die` |
23
+ | `mrdk[sim]` | gplugins (tidy3d, femwell, meow) | `sim` |
24
+
25
+ ### Development
26
+
27
+ ```powershell
28
+ uv sync --all-extras
29
+ uv run pytest
30
+ uv run ruff check .
31
+ uv run ruff format .
32
+ ```
33
+
34
+ ## Example: edge-coupled ring die
35
+
36
+ `examples/edge_ring_die_cspdk.py` builds a die of all-pass rings on the open Cornerstone SiN PDK
37
+ (`cspdk`): rows sweep the waveguide width, rings along each row sweep the gap, some rows have
38
+ heaters. Each ring has a finite coupling bus, a taper, an S-bend and two inverse-taper edge
39
+ couplers whose facets cross the die edges into the dicing lane (`dicing_extension`, 20 µm
40
+ here), staggered so rows of rings share the edge (`mrdk.die.edge_row`). It writes the GDS and
41
+ the device manifest (CSV and JSON).
42
+
43
+ ```powershell
44
+ uv sync --all-extras
45
+ uv run python examples/edge_ring_die_cspdk.py # writes to examples/_out
46
+ ```
47
+
48
+ `cspdk` is a development dependency of this repo (installed by `uv sync`), not part of the
49
+ `mrdk[layout]` extra: outside this repo, install it yourself (`pip install cspdk`).
50
+
51
+ Rows can have arc heaters (`heater=True`) and photonic-crystal rings (`pcr_n_periods`, per ring).
52
+
53
+ Resonantly-coupled systems (a resonant coupler feeding a nonlinear resonator, after Zhu et al.,
54
+ 2026) are built with `mrdk.components.resonator_chain`: a vertical stack of `Resonator`s between
55
+ an input bus and an output bus with a tapered end, each end ring with its own heater (see
56
+ `docs/design/coupled_resonators.md`). `mrdk.components.resonator_edge` routes such a system to
57
+ an input facet and to through and comb-output facets, and `mrdk.die.resonator_row` lays them
58
+ out in rows sweeping the gap between the two resonators. `examples/rc_nr_die_cspdk.py` builds a
59
+ two-row example die (straight and pulley input buses):
60
+
61
+ ```powershell
62
+ uv run python examples/rc_nr_die_cspdk.py # writes RCNR1.gds and its manifest
63
+ ```
64
+
65
+ To check a rebuild against an existing GDS (for example in a private tape-out repo that has
66
+ the real PDK), `mrdk.die.gds_xor(reference, rebuild)` XORs two files layer by layer; the recipe
67
+ is in `docs/design/parity_check.md`.
68
+
69
+ The building blocks, all in µm:
70
+
71
+ ```python
72
+ import mrdk
73
+ from cspdk.sin300 import PDK
74
+ from mrdk.components import ring_allpass
75
+ from mrdk.die import assemble, sweep_block
76
+
77
+ mrdk.activate_pdk(PDK) # use this instead of PDK.activate() when switching PDKs
78
+ block = sweep_block(
79
+ ring_allpass,
80
+ die="D1",
81
+ row_param="width",
82
+ row_values=[1.2, 1.4],
83
+ ring_param="gap",
84
+ ring_values=[0.3, 0.4, 0.5],
85
+ component_kwargs={"radius": 100},
86
+ )
87
+ die, manifest = assemble([block], die="D1", die_size=(5000, 5000), gds_path="D1.gds")
88
+ ```
89
+
90
+ What `assemble` draws on the die, by layer role: the chip outline on `floorplan` (all four
91
+ sides), the printed die name and the corner alignment crosses on `label_text`, a layer the foundry
92
+ patterns. The cspdk preset prints text in the nitride core (`NITRIDE`), because cspdk has no
93
+ patterned text layer, and keeps GDS text labels for tools on `LBL` (`label_info`).
94
+
95
+ By default `assemble` stacks the blocks upwards. To place them yourself, pass
96
+ `positions=[(x, y), mrdk.die.Placement(x, y, rotation=90, mirror=True), ...]`: the lower-left
97
+ corner of each block's footprint in die coordinates (µm). It replaces `inset`, `inset_x` and
98
+ `block_gap`, and checks overlap (`min_block_gap`), the outline, the alignment marks and the die
99
+ label; edge-coupled blocks need `x=0`, the full die width and no rotation. See the `assemble`
100
+ docstring.
101
+
102
+ Foundry layers, rules and cells always come from the PDK you activate; mrdk never hard-codes
103
+ them. `mrdk.die.check` runs a design-time rule check against a table you fill in from your
104
+ foundry's manual (the numbers below are made up), and the foundry's own DRC deck can be hooked
105
+ in with `assemble(..., drc=callable)`:
106
+
107
+ ```python
108
+ from mrdk.die import LayerRules, Rules, check
109
+
110
+ rules = Rules(layers={"NITRIDE": LayerRules(min_width=0.15, min_space=0.5, outside_outline=20)})
111
+ report = check("Die2_edge.gds", rules)
112
+ print(report.summary())
113
+ report.write_lyrdb("Die2_edge.lyrdb") # open in KLayout's marker browser
114
+ # or: assemble(..., gds_path=..., check=rules) raises on violations, writes the .lyrdb
115
+ ```
116
+
117
+ Other checks built into the components: rings smaller than the cross-section's minimum bend
118
+ radius are rejected, `min_feature=` on `edge_coupler`/`ring_edge` rejects narrower waveguides,
119
+ heater pads must clear every waveguide by `pad_clearance` (5 µm), and `die.device(...,
120
+ fiber_pitch=127)` spaces the two gratings by a whole number of fibre-array channels.
121
+
122
+ ## Simulation (v0.2, in progress)
123
+
124
+ `mrdk.sim.mode_solve` gives the guided modes of a waveguide of the active PDK (femwell finite
125
+ elements through gplugins, runs locally in a few seconds; needs the `sim` extra):
126
+
127
+ ```python
128
+ import mrdk
129
+ from cspdk.sin300 import PDK
130
+ from mrdk.sim import mode_solve
131
+
132
+ mrdk.activate_pdk(PDK)
133
+ result = mode_solve(1.5) # 1.5 um wide nitride guide at 1.55 um
134
+ print(result.fundamental_te.n_eff) # about 1.619 (cspdk has no cladding: oxide is assumed)
135
+ print(mode_solve(1.5, radius_um=237).fundamental_te.n_eff) # bent, referred to the centre
136
+ ```
137
+
138
+ `mrdk.sim.dispersion` sweeps the bent ring's TE0 mode over wavelength and gives n_g, FSR, D2 and
139
+ the integrated dispersion D_int (frequencies in Hz; about 4 s per wavelength). The numpy part,
140
+ `dispersion_from_neff(wavelengths_um, n_eff, length_um)`, also takes your own n_eff data:
141
+
142
+ ```python
143
+ import numpy as np
144
+ from mrdk.sim import dispersion
145
+
146
+ d = dispersion(1.5, 237.0, np.linspace(1.50, 1.60, 6), pump_wavelength_um=1.55)
147
+ print(d.pump_fsr_hz / 1e9, d.pump_d2_hz / 1e6) # about 101.7 GHz and -9.7 MHz (normal)
148
+ ```
149
+
150
+ ## Check a GDS against its manifest
151
+
152
+ `assemble` records the mrdk version, a hash of the design, the build time and the GDS file name
153
+ in the manifest (the GDS itself carries no version or hash text). Before measuring, check that
154
+ a GDS and a manifest belong together: the die name and every device's printed facet labels must
155
+ be in the GDS at the facet positions of the manifest (needs the `layout` extra, no PDK):
156
+
157
+ ```powershell
158
+ uv run python -m mrdk.die verify examples/_out/Die2_edge.gds examples/_out/Die2_edge_manifest.csv
159
+ ```
160
+
161
+ It prints `OK` (exit code 0) or the mismatches (exit code 1): another design, a manifest
162
+ edited after it was written, or the die name or device labels missing from the GDS (or not at
163
+ their facets, or a different number of them).
164
+
165
+ ## License
166
+
167
+ Apache-2.0. See [LICENSE](LICENSE).
@@ -0,0 +1,78 @@
1
+ [project]
2
+ name = "mrdk"
3
+ version = "0.1.0"
4
+ description = "MicroResonator Design Kit: physics targets -> layout -> device manifest, built on GDSFactory."
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ license = "Apache-2.0"
8
+ license-files = ["LICENSE"]
9
+ keywords = [
10
+ "photonics",
11
+ "microresonator",
12
+ "ring resonator",
13
+ "silicon nitride",
14
+ "integrated photonics",
15
+ "gdsfactory",
16
+ "gds",
17
+ "layout",
18
+ "pdk",
19
+ ]
20
+ classifiers = [
21
+ "Development Status :: 4 - Beta",
22
+ "Intended Audience :: Science/Research",
23
+ "Topic :: Scientific/Engineering :: Physics",
24
+ "Programming Language :: Python :: 3",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Operating System :: OS Independent",
28
+ "Typing :: Typed",
29
+ ]
30
+ dependencies = []
31
+
32
+ [[project.authors]]
33
+ name = "Nicholas Pankow"
34
+ email = "pankonic@gmail.com"
35
+
36
+ [[project.maintainers]]
37
+ name = "Nicholas Pankow"
38
+ email = "pankonic@gmail.com"
39
+
40
+ [project.urls]
41
+ Homepage = "https://github.com/pankonic/mrdk"
42
+ Repository = "https://github.com/pankonic/mrdk"
43
+ Issues = "https://github.com/pankonic/mrdk/issues"
44
+ Changelog = "https://github.com/pankonic/mrdk/blob/main/CHANGELOG.md"
45
+
46
+ [project.optional-dependencies]
47
+ layout = ["gdsfactory>=9.51,<10"]
48
+ sim = ["gplugins[tidy3d,femwell,meow]>=2.1,<3"]
49
+
50
+ [dependency-groups]
51
+ dev = [
52
+ "cspdk>=2.1,<3; python_version < '3.13'",
53
+ "pytest>=9.2,<10",
54
+ "ruff>=0.17,<0.18",
55
+ ]
56
+
57
+ [build-system]
58
+ requires = ["uv_build>=0.13.9,<0.14.0"]
59
+ build-backend = "uv_build"
60
+
61
+ [tool.pytest.ini_options]
62
+ testpaths = ["tests"]
63
+
64
+ [tool.ruff]
65
+ line-length = 100
66
+ src = [
67
+ "src",
68
+ "tests",
69
+ ]
70
+
71
+ [tool.ruff.lint]
72
+ select = [
73
+ "E",
74
+ "F",
75
+ "I",
76
+ "UP",
77
+ "B",
78
+ ]