2023-10-15 16:16:29 -07:00
|
|
|
masque Tutorial
|
|
|
|
|
===============
|
|
|
|
|
|
2026-04-02 12:19:51 -07:00
|
|
|
These examples are meant to be read roughly in order.
|
|
|
|
|
|
|
|
|
|
- Start with `basic_shapes.py` for the core `Pattern` / GDS concepts.
|
|
|
|
|
- Then read `devices.py` and `library.py` for hierarchical composition and libraries.
|
|
|
|
|
- Read the `pather*` tutorials separately when you want routing helpers.
|
|
|
|
|
|
2023-10-15 16:16:29 -07:00
|
|
|
Contents
|
|
|
|
|
--------
|
|
|
|
|
|
|
|
|
|
- [basic_shapes](basic_shapes.py):
|
|
|
|
|
* Draw basic geometry
|
|
|
|
|
* Export to GDS
|
|
|
|
|
- [devices](devices.py)
|
2026-04-02 12:19:51 -07:00
|
|
|
* Build hierarchical photonic-crystal example devices
|
2023-10-15 16:16:29 -07:00
|
|
|
* Reference other patterns
|
|
|
|
|
* Add ports to a pattern
|
2026-04-02 12:19:51 -07:00
|
|
|
* Use `Builder` to snap ports together into a circuit
|
2023-10-15 16:16:29 -07:00
|
|
|
* Check for dangling references
|
|
|
|
|
- [library](library.py)
|
2026-04-02 12:19:51 -07:00
|
|
|
* Continue from `devices.py` using a lazy library
|
2023-10-15 16:16:29 -07:00
|
|
|
* Create a `LazyLibrary`, which loads / generates patterns only when they are first used
|
|
|
|
|
* Explore alternate ways of specifying a pattern for `.plug()` and `.place()`
|
|
|
|
|
* Design a pattern which is meant to plug into an existing pattern (via `.interface()`)
|
|
|
|
|
- [pather](pather.py)
|
|
|
|
|
* Use `Pather` to route individual wires and wire bundles
|
2026-02-15 20:05:38 -08:00
|
|
|
* Use `AutoTool` to generate paths
|
|
|
|
|
* Use `AutoTool` to automatically transition between path types
|
|
|
|
|
- [renderpather](renderpather.py)
|
2023-10-15 16:16:29 -07:00
|
|
|
* Use `RenderPather` and `PathTool` to build a layout similar to the one in [pather](pather.py),
|
|
|
|
|
but using `Path` shapes instead of `Polygon`s.
|
2026-02-15 20:05:38 -08:00
|
|
|
- [port_pather](port_pather.py)
|
|
|
|
|
* Use `PortPather` and the `.at()` syntax for more concise routing
|
|
|
|
|
* Advanced port manipulation and connections
|
2023-10-15 16:16:29 -07:00
|
|
|
|
|
|
|
|
|
2026-04-02 12:19:51 -07:00
|
|
|
Additionally, [pcgen](pcgen.py) is a utility module used by `devices.py` for generating
|
|
|
|
|
photonic-crystal lattices; it is support code rather than a step-by-step tutorial.
|
2023-10-15 16:16:29 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Running
|
|
|
|
|
-------
|
|
|
|
|
|
|
|
|
|
Run from inside the examples directory:
|
|
|
|
|
```bash
|
|
|
|
|
cd examples/tutorial
|
|
|
|
|
python3 basic_shapes.py
|
|
|
|
|
klayout -e basic_shapes.gds
|
|
|
|
|
```
|
2026-04-02 12:19:51 -07:00
|
|
|
|
|
|
|
|
Some tutorials depend on outputs from earlier ones. In particular, `library.py`
|
|
|
|
|
expects `circuit.gds`, which is generated by `devices.py`.
|