[library] More library rework
This commit is contained in:
parent
67afee7704
commit
0edd735a11
25 changed files with 2357 additions and 870 deletions
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Tutorial: authoring a mixed library with `BuildLibrary`.
|
||||
Tutorial: authoring a mixed library with `LibraryBuilder`.
|
||||
|
||||
This example assumes you have already read `devices.py` and generated the
|
||||
`circuit.gds` file it writes. The goal here is not the photonic-crystal geometry
|
||||
|
|
@ -11,7 +11,7 @@ from typing import Any
|
|||
from pprint import pformat
|
||||
|
||||
|
||||
from masque import BuildLibrary, Pather, Pattern, cell
|
||||
from masque import ILibrary, LibraryBuilder, Pather, Pattern, cell
|
||||
from masque.file.gdsii import writefile
|
||||
from masque.file.gdsii.lazy import readfile
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ import devices
|
|||
from basic_shapes import GDS_OPTS
|
||||
|
||||
|
||||
def make_mixed_waveguide(lib: BuildLibrary) -> Pattern:
|
||||
def make_mixed_waveguide(lib: ILibrary) -> Pattern:
|
||||
"""
|
||||
Recipe which assembles imported and generated cells behind the builder API.
|
||||
"""
|
||||
|
|
@ -42,7 +42,7 @@ def make_mixed_waveguide(lib: BuildLibrary) -> Pattern:
|
|||
|
||||
|
||||
def main() -> None:
|
||||
builder = BuildLibrary()
|
||||
builder = LibraryBuilder()
|
||||
cells = builder.cells
|
||||
|
||||
#
|
||||
|
|
@ -72,8 +72,12 @@ def main() -> None:
|
|||
cells.tri_wg28 = cell(devices.waveguide)(length=28, mirror_periods=5, **opts)
|
||||
cells.tri_bend0 = cell(devices.bend)(mirror_periods=5, **opts)
|
||||
cells.tri_ysplit = cell(devices.y_splitter)(mirror_periods=5, **opts)
|
||||
cells.tri_l3cav = cell(devices.perturbed_l3)(xy_size=(4, 10), **opts, hole_lib=builder)
|
||||
cells.mixed_wg_cav = cell(make_mixed_waveguide)(builder)
|
||||
cells.tri_l3cav = cell(devices.perturbed_l3)(
|
||||
xy_size=(4, 10),
|
||||
**opts,
|
||||
hole_lib=builder.library,
|
||||
)
|
||||
cells.mixed_wg_cav = cell(make_mixed_waveguide)(builder.library)
|
||||
|
||||
print('Declared cells waiting to be built:\n' + pformat(list(builder.keys())))
|
||||
|
||||
|
|
@ -110,6 +114,10 @@ def main() -> None:
|
|||
print('Writing library to file...')
|
||||
writefile(built, 'library.gds', **GDS_OPTS)
|
||||
|
||||
# The default build output is an overlay which borrows its lazy sources.
|
||||
# Close the owning GDS source only after the overlay is no longer needed.
|
||||
gds_lib.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue