Skip to main content

mrdk — MicroResonator Design Kit

Open-source Python library for designing on-chip microresonator chips, built on GDSFactory. The flow is: physics targets -> layout -> device manifest, with measurement analysis planned.

Status: beta (first public release). Components, die generators and the manifest work, and sim has mode_solve, dispersion and coupling helpers. Fast circuit models (SAX) and measurement analysis (a RingFit port) are planned for later releases — see docs/ROADMAP.md.

Install

pip install mrdk            # base: manifest only, no heavy dependencies
pip install "mrdk[layout]"  # + gdsfactory: components and die
pip install "mrdk[sim]"     # + gplugins: mode solving and dispersion
Install Adds Enables
mrdk nothing heavy manifest
mrdk[layout] gdsfactory components, die
mrdk[sim] gplugins (tidy3d, femwell, meow) sim

Development

uv sync --all-extras
uv run pytest
uv run ruff check .
uv run ruff format .

Example: edge-coupled ring die

examples/edge_ring_die_cspdk.py builds a die of all-pass rings on the open Cornerstone SiN PDK (cspdk): rows sweep the waveguide width, rings along each row sweep the gap, some rows have heaters. Each ring has a finite coupling bus, a taper, an S-bend and two inverse-taper edge couplers whose facets cross the die edges into the dicing lane (dicing_extension, 20 µm here), staggered so rows of rings share the edge (mrdk.die.edge_row). It writes the GDS and the device manifest (CSV and JSON).

uv sync --all-extras
uv run python examples/edge_ring_die_cspdk.py          # writes to examples/_out

cspdk is a development dependency of this repo (installed by uv sync), not part of the mrdk[layout] extra: outside this repo, install it yourself (pip install cspdk).

Rows can have arc heaters (heater=True) and photonic-crystal rings (pcr_n_periods, per ring).

Resonantly-coupled systems (a resonant coupler feeding a nonlinear resonator, after Zhu et al., 2026) are built with mrdk.components.resonator_chain: a vertical stack of Resonators between an input bus and an output bus with a tapered end, each end ring with its own heater (see docs/design/coupled_resonators.md). mrdk.components.resonator_edge routes such a system to an input facet and to through and comb-output facets, and mrdk.die.resonator_row lays them out in rows sweeping the gap between the two resonators. examples/rc_nr_die_cspdk.py builds a two-row example die (straight and pulley input buses):

uv run python examples/rc_nr_die_cspdk.py          # writes RCNR1.gds and its manifest

To check a rebuild against an existing GDS (for example in a private tape-out repo that has the real PDK), mrdk.die.gds_xor(reference, rebuild) XORs two files layer by layer; the recipe is in docs/design/parity_check.md.

The building blocks, all in µm:

import mrdk
from cspdk.sin300 import PDK
from mrdk.components import ring_allpass
from mrdk.die import assemble, sweep_block

mrdk.activate_pdk(PDK)  # use this instead of PDK.activate() when switching PDKs
block = sweep_block(
    ring_allpass,
    die="D1",
    row_param="width",
    row_values=[1.2, 1.4],
    ring_param="gap",
    ring_values=[0.3, 0.4, 0.5],
    component_kwargs={"radius": 100},
)
die, manifest = assemble([block], die="D1", die_size=(5000, 5000), gds_path="D1.gds")

What assemble draws on the die, by layer role: the chip outline on floorplan (all four sides), the printed die name and the corner alignment crosses on label_text, a layer the foundry patterns. The cspdk preset prints text in the nitride core (NITRIDE), because cspdk has no patterned text layer, and keeps GDS text labels for tools on LBL (label_info).

By default assemble stacks the blocks upwards. To place them yourself, pass positions=[(x, y), mrdk.die.Placement(x, y, rotation=90, mirror=True), ...]: the lower-left corner of each block's footprint in die coordinates (µm). It replaces inset, inset_x and block_gap, and checks overlap (min_block_gap), the outline, the alignment marks and the die label; edge-coupled blocks need x=0, the full die width and no rotation. See the assemble docstring.

Foundry layers, rules and cells always come from the PDK you activate; mrdk never hard-codes them. mrdk.die.check runs a design-time rule check against a table you fill in from your foundry's manual (the numbers below are made up), and the foundry's own DRC deck can be hooked in with assemble(..., drc=callable):

from mrdk.die import LayerRules, Rules, check

rules = Rules(layers={"NITRIDE": LayerRules(min_width=0.15, min_space=0.5, outside_outline=20)})
report = check("Die2_edge.gds", rules)
print(report.summary())
report.write_lyrdb("Die2_edge.lyrdb")  # open in KLayout's marker browser
# or: assemble(..., gds_path=..., check=rules)  raises on violations, writes the .lyrdb

Other checks built into the components: rings smaller than the cross-section's minimum bend radius are rejected, min_feature= on edge_coupler/ring_edge rejects narrower waveguides, heater pads must clear every waveguide by pad_clearance (5 µm), and die.device(..., fiber_pitch=127) spaces the two gratings by a whole number of fibre-array channels.

Simulation (v0.2, in progress)

mrdk.sim.mode_solve gives the guided modes of a waveguide of the active PDK (femwell finite elements through gplugins, runs locally in a few seconds; needs the sim extra):

import mrdk
from cspdk.sin300 import PDK
from mrdk.sim import mode_solve

mrdk.activate_pdk(PDK)
result = mode_solve(1.5)  # 1.5 um wide nitride guide at 1.55 um
print(result.fundamental_te.n_eff)  # about 1.619 (cspdk has no cladding: oxide is assumed)
print(mode_solve(1.5, radius_um=237).fundamental_te.n_eff)  # bent, referred to the centre

mrdk.sim.dispersion sweeps the bent ring's TE0 mode over wavelength and gives n_g, FSR, D2 and the integrated dispersion D_int (frequencies in Hz; about 4 s per wavelength). The numpy part, dispersion_from_neff(wavelengths_um, n_eff, length_um), also takes your own n_eff data:

import numpy as np
from mrdk.sim import dispersion

d = dispersion(1.5, 237.0, np.linspace(1.50, 1.60, 6), pump_wavelength_um=1.55)
print(d.pump_fsr_hz / 1e9, d.pump_d2_hz / 1e6)  # about 101.7 GHz and -9.7 MHz (normal)

Check a GDS against its manifest

assemble records the mrdk version, a hash of the design, the build time and the GDS file name in the manifest (the GDS itself carries no version or hash text). Before measuring, check that a GDS and a manifest belong together: the die name and every device's printed facet labels must be in the GDS at the facet positions of the manifest (needs the layout extra, no PDK):

uv run python -m mrdk.die verify examples/_out/Die2_edge.gds examples/_out/Die2_edge_manifest.csv

It prints OK (exit code 0) or the mismatches (exit code 1): another design, a manifest edited after it was written, or the die name or device labels missing from the GDS (or not at their facets, or a different number of them).

License

Apache-2.0. See LICENSE.

Metadata

Release files for mrdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mrdk 0.1.0
File Size Uploaded Provenance Actions
mrdk-0.1.0.tar.gz 111.6 kB With provenance Details for mrdk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mrdk 0.1.0
File Interpreter ABI Platform Actions
mrdk-0.1.0-py3-none-any.whl Python 3 none any Details for mrdk-0.1.0-py3-none-any.whl

Total release size: 242.9 kB

Release files / mrdk-0.1.0.tar.gz

Download URL mrdk-0.1.0.tar.gz
Size 111.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3ee05a9f681dde469a2c891bd346b44319f7b907a58e2b866c7a6b8fd1f90b18
BLAKE2b-256 checksum
How to use checksums
d5b2378dd323cea99f566d839816deba7eb7407ad303dc91c275616ca0abe0a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Release files / mrdk-0.1.0-py3-none-any.whl

Download URL mrdk-0.1.0-py3-none-any.whl
Size 131.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
378a402038c4fc6f3edcf65cda2b0418aa6103e6ac4c4c5bf83840612d10c8bb
BLAKE2b-256 checksum
How to use checksums
a12262098110b5f2c42ef21fa2d9ef3f86ef3ced28b19780c7b8188a46eddf0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Security for mrdk 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mrdk-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page