This repository contains the paper introducing GDSFactory to the integrated-photonics community. The paper is a tutorial: it designs a small WDM transceiver chip step by step, and every code example is printed next to its result.
| File | Content |
|---|---|
paper.md |
The paper (MyST Markdown). |
notebooks/transceiver.ipynb |
All code examples. Cells tagged with `# |
src/gf_photonics_paper/ |
Small helpers: print-friendly rendering of components (render.py), plot helpers (plots.py) and conversion of cross-sections + layer stack into polygons for FEM solvers (geometry.py). PNGs carry a gfmeta text chunk (figure kind, scale-bar label position) read by the Typst template. |
templates/gf-preprint/ |
Typst template (based on LaPreprint). sbs.typ lays out the code/result figures. |
util/side_by_side.mjs |
MyST plugin providing the side-by-side directive. |
references.bib |
Bibliography. |
- uv (installs Python 3.13 and all Python dependencies, including
gdsfactory==9.51.0) - Node.js ≥ 20 and MyST:
npm install -g mystmd@1.14.0 - Typst ≥ 0.13 for the PDF
uv sync
uv run myst build --pdf --execute # PDF -> exports/paper.pdf
uv run myst start --execute # web version with the executable notebookThe notebook executes in about two minutes on a laptop. To run only the notebook:
uv run jupyter nbconvert --to notebook --execute notebooks/transceiver.ipynb --output /tmp/out.ipynbAfter editing a notebooks/*.py file, re-sync the notebook with
uv run jupytext --sync notebooks/<name>.py. When running notebook code as a plain
script, set MPLBACKEND=Agg so that plt.show() does not open (blocking) windows;
the notebooks themselves use the inline backend.
- Keep code lines ≤ 58 characters and cells ≤ ~35 lines.
- A cell becomes a figure via
:::{side-by-side} #<label>inpaper.md; the figure label isfig-<label>. - The Typst template places code and result side by side with equal heights. If a result is
so wide that it would become tiny next to the code, it is placed below the code instead
(see the comments in
templates/gf-preprint/sbs.typ). No manual sizing is required. - Components are displayed with the renderer in
src/gf_photonics_paper/render.py(white background, ports as arrows, scale bar). - Avoid printing and displaying in the same cell; use the cell tag
remove-stdoutif a library prints diagnostics.
gdsfactory/ and util/lapreprint-typst/ are leftovers from earlier drafts: the paper now
uses the released gdsfactory==9.51.0 from PyPI and the template in templates/gf-preprint/.
Both submodules can be removed (git rm gdsfactory util/lapreprint-typst).