diff --git a/examples/tutorial/basic.py b/examples/tutorial/basic.py index 041784a..409da2b 100644 --- a/examples/tutorial/basic.py +++ b/examples/tutorial/basic.py @@ -12,9 +12,10 @@ import masque.file.gdsii import pcgen -def hole(radius: float, - layer: layer_t = (1, 0), - ) -> Pattern: +def hole( + radius: float, + layer: layer_t = (1, 0), + ) -> Pattern: """ Generate a pattern containing a single circular hole. @@ -31,10 +32,11 @@ def hole(radius: float, return pat -def smile(radius: float, - layer: layer_t = (1, 0), - secondary_layer: layer_t = (1, 2) - ) -> Pattern: +def smile( + radius: float, + layer: layer_t = (1, 0), + secondary_layer: layer_t = (1, 2) + ) -> Pattern: """ Generate a pattern containing a single smiley face. diff --git a/examples/tutorial/pcgen.py b/examples/tutorial/pcgen.py index 850f143..285c5ec 100644 --- a/examples/tutorial/pcgen.py +++ b/examples/tutorial/pcgen.py @@ -7,10 +7,11 @@ from typing import Sequence, Tuple import numpy # type: ignore -def triangular_lattice(dims: Tuple[int, int], - asymmetric: bool = False, - origin: str = 'center', - ) -> numpy.ndarray: +def triangular_lattice( + dims: Tuple[int, int], + asymmetric: bool = False, + origin: str = 'center', + ) -> numpy.ndarray: """ Return an ndarray of `[[x0, y0], [x1, y1], ...]` denoting lattice sites for a triangular lattice in 2D. @@ -71,10 +72,11 @@ def square_lattice(dims: Tuple[int, int]) -> numpy.ndarray: # ### Photonic crystal functions ### -def nanobeam_holes(a_defect: float, - num_defect_holes: int, - num_mirror_holes: int - ) -> numpy.ndarray: +def nanobeam_holes( + a_defect: float, + num_defect_holes: int, + num_mirror_holes: int + ) -> numpy.ndarray: """ Returns a list of `[[x0, r0], [x1, r1], ...]` of nanobeam hole positions and radii. Creates a region in which the lattice constant and radius are progressively @@ -175,9 +177,10 @@ def y_splitter(num_mirror: int) -> numpy.ndarray: return p -def ln_defect(mirror_dims: Tuple[int, int], - defect_length: int, - ) -> numpy.ndarray: +def ln_defect( + mirror_dims: Tuple[int, int], + defect_length: int, + ) -> numpy.ndarray: """ N-hole defect in a triangular lattice. @@ -198,11 +201,12 @@ def ln_defect(mirror_dims: Tuple[int, int], return p[numpy.logical_or(holes_to_keep, p[:, 1] != 0), ] -def ln_shift_defect(mirror_dims: Tuple[int, int], - defect_length: int, - shifts_a: Sequence[float] = (0.15, 0, 0.075), - shifts_r: Sequence[float] = (1, 1, 1) - ) -> numpy.ndarray: +def ln_shift_defect( + mirror_dims: Tuple[int, int], + defect_length: int, + shifts_a: Sequence[float] = (0.15, 0, 0.075), + shifts_r: Sequence[float] = (1, 1, 1) + ) -> numpy.ndarray: """ N-hole defect with shifted holes (intended to give the mode a gaussian profile in real- and k-space so as to improve both Q and confinement). Holes along the @@ -276,11 +280,11 @@ def r6_defect(mirror_dims: Tuple[int, int]) -> numpy.ndarray: def l3_shift_perturbed_defect( - mirror_dims: Tuple[int, int], - perturbed_radius: float = 1.1, - shifts_a: Sequence[float] = (), - shifts_r: Sequence[float] = () - ) -> numpy.ndarray: + mirror_dims: Tuple[int, int], + perturbed_radius: float = 1.1, + shifts_a: Sequence[float] = (), + shifts_r: Sequence[float] = () + ) -> numpy.ndarray: """ 3-hole defect with perturbed hole sizes intended to form an upwards-directed beam. Can also include shifted holes along the defect line, intended diff --git a/examples/tutorial/phc.py b/examples/tutorial/phc.py index d69882e..b43f9ed 100644 --- a/examples/tutorial/phc.py +++ b/examples/tutorial/phc.py @@ -13,16 +13,17 @@ import pcgen import basic -def perturbed_l3(lattice_constant: float, - hole: Pattern, - trench_dose: float = 1.0, - trench_layer: layer_t = (1, 0), - shifts_a: Sequence[float] = (0.15, 0, 0.075), - shifts_r: Sequence[float] = (1.0, 1.0, 1.0), - xy_size: Tuple[int, int] = (10, 10), - perturbed_radius: float = 1.1, - trench_width: float = 1200, - ) -> Device: +def perturbed_l3( + lattice_constant: float, + hole: Pattern, + trench_dose: float = 1.0, + trench_layer: layer_t = (1, 0), + shifts_a: Sequence[float] = (0.15, 0, 0.075), + shifts_r: Sequence[float] = (1.0, 1.0, 1.0), + xy_size: Tuple[int, int] = (10, 10), + perturbed_radius: float = 1.1, + trench_width: float = 1200, + ) -> Device: """ Generate a `Device` representing a perturbed L3 cavity. @@ -78,11 +79,12 @@ def perturbed_l3(lattice_constant: float, return Device(pat, ports) -def waveguide(lattice_constant: float, - hole: Pattern, - length: int, - mirror_periods: int, - ) -> Device: +def waveguide( + lattice_constant: float, + hole: Pattern, + length: int, + mirror_periods: int, + ) -> Device: """ Generate a `Device` representing a photonic crystal line-defect waveguide. @@ -111,10 +113,11 @@ def waveguide(lattice_constant: float, return Device(pat, ports) -def bend(lattice_constant: float, - hole: Pattern, - mirror_periods: int, - ) -> Device: +def bend( + lattice_constant: float, + hole: Pattern, + mirror_periods: int, + ) -> Device: """ Generate a `Device` representing a 60-degree counterclockwise bend in a photonic crystal line-defect waveguide. @@ -144,10 +147,11 @@ def bend(lattice_constant: float, return Device(pat, ports) -def y_splitter(lattice_constant: float, - hole: Pattern, - mirror_periods: int, - ) -> Device: +def y_splitter( + lattice_constant: float, + hole: Pattern, + mirror_periods: int, + ) -> Device: """ Generate a `Device` representing a photonic crystal line-defect waveguide y-splitter.