reformat arg lists

This commit is contained in:
jan 2022-02-23 11:00:40 -08:00
parent 9b3b30b141
commit 40c81f53ed
3 changed files with 61 additions and 51 deletions

View File

@ -12,9 +12,10 @@ import masque.file.gdsii
import pcgen import pcgen
def hole(radius: float, def hole(
layer: layer_t = (1, 0), radius: float,
) -> Pattern: layer: layer_t = (1, 0),
) -> Pattern:
""" """
Generate a pattern containing a single circular hole. Generate a pattern containing a single circular hole.
@ -31,10 +32,11 @@ def hole(radius: float,
return pat return pat
def smile(radius: float, def smile(
layer: layer_t = (1, 0), radius: float,
secondary_layer: layer_t = (1, 2) layer: layer_t = (1, 0),
) -> Pattern: secondary_layer: layer_t = (1, 2)
) -> Pattern:
""" """
Generate a pattern containing a single smiley face. Generate a pattern containing a single smiley face.

View File

@ -7,10 +7,11 @@ from typing import Sequence, Tuple
import numpy # type: ignore import numpy # type: ignore
def triangular_lattice(dims: Tuple[int, int], def triangular_lattice(
asymmetric: bool = False, dims: Tuple[int, int],
origin: str = 'center', asymmetric: bool = False,
) -> numpy.ndarray: origin: str = 'center',
) -> numpy.ndarray:
""" """
Return an ndarray of `[[x0, y0], [x1, y1], ...]` denoting lattice sites for Return an ndarray of `[[x0, y0], [x1, y1], ...]` denoting lattice sites for
a triangular lattice in 2D. a triangular lattice in 2D.
@ -71,10 +72,11 @@ def square_lattice(dims: Tuple[int, int]) -> numpy.ndarray:
# ### Photonic crystal functions ### # ### Photonic crystal functions ###
def nanobeam_holes(a_defect: float, def nanobeam_holes(
num_defect_holes: int, a_defect: float,
num_mirror_holes: int num_defect_holes: int,
) -> numpy.ndarray: num_mirror_holes: int
) -> numpy.ndarray:
""" """
Returns a list of `[[x0, r0], [x1, r1], ...]` of nanobeam hole positions and radii. 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 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 return p
def ln_defect(mirror_dims: Tuple[int, int], def ln_defect(
defect_length: int, mirror_dims: Tuple[int, int],
) -> numpy.ndarray: defect_length: int,
) -> numpy.ndarray:
""" """
N-hole defect in a triangular lattice. 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), ] return p[numpy.logical_or(holes_to_keep, p[:, 1] != 0), ]
def ln_shift_defect(mirror_dims: Tuple[int, int], def ln_shift_defect(
defect_length: int, mirror_dims: Tuple[int, int],
shifts_a: Sequence[float] = (0.15, 0, 0.075), defect_length: int,
shifts_r: Sequence[float] = (1, 1, 1) shifts_a: Sequence[float] = (0.15, 0, 0.075),
) -> numpy.ndarray: shifts_r: Sequence[float] = (1, 1, 1)
) -> numpy.ndarray:
""" """
N-hole defect with shifted holes (intended to give the mode a gaussian profile 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 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( def l3_shift_perturbed_defect(
mirror_dims: Tuple[int, int], mirror_dims: Tuple[int, int],
perturbed_radius: float = 1.1, perturbed_radius: float = 1.1,
shifts_a: Sequence[float] = (), shifts_a: Sequence[float] = (),
shifts_r: Sequence[float] = () shifts_r: Sequence[float] = ()
) -> numpy.ndarray: ) -> numpy.ndarray:
""" """
3-hole defect with perturbed hole sizes intended to form an upwards-directed 3-hole defect with perturbed hole sizes intended to form an upwards-directed
beam. Can also include shifted holes along the defect line, intended beam. Can also include shifted holes along the defect line, intended

View File

@ -13,16 +13,17 @@ import pcgen
import basic import basic
def perturbed_l3(lattice_constant: float, def perturbed_l3(
hole: Pattern, lattice_constant: float,
trench_dose: float = 1.0, hole: Pattern,
trench_layer: layer_t = (1, 0), trench_dose: float = 1.0,
shifts_a: Sequence[float] = (0.15, 0, 0.075), trench_layer: layer_t = (1, 0),
shifts_r: Sequence[float] = (1.0, 1.0, 1.0), shifts_a: Sequence[float] = (0.15, 0, 0.075),
xy_size: Tuple[int, int] = (10, 10), shifts_r: Sequence[float] = (1.0, 1.0, 1.0),
perturbed_radius: float = 1.1, xy_size: Tuple[int, int] = (10, 10),
trench_width: float = 1200, perturbed_radius: float = 1.1,
) -> Device: trench_width: float = 1200,
) -> Device:
""" """
Generate a `Device` representing a perturbed L3 cavity. Generate a `Device` representing a perturbed L3 cavity.
@ -78,11 +79,12 @@ def perturbed_l3(lattice_constant: float,
return Device(pat, ports) return Device(pat, ports)
def waveguide(lattice_constant: float, def waveguide(
hole: Pattern, lattice_constant: float,
length: int, hole: Pattern,
mirror_periods: int, length: int,
) -> Device: mirror_periods: int,
) -> Device:
""" """
Generate a `Device` representing a photonic crystal line-defect waveguide. Generate a `Device` representing a photonic crystal line-defect waveguide.
@ -111,10 +113,11 @@ def waveguide(lattice_constant: float,
return Device(pat, ports) return Device(pat, ports)
def bend(lattice_constant: float, def bend(
hole: Pattern, lattice_constant: float,
mirror_periods: int, hole: Pattern,
) -> Device: mirror_periods: int,
) -> Device:
""" """
Generate a `Device` representing a 60-degree counterclockwise bend in a photonic crystal Generate a `Device` representing a 60-degree counterclockwise bend in a photonic crystal
line-defect waveguide. line-defect waveguide.
@ -144,10 +147,11 @@ def bend(lattice_constant: float,
return Device(pat, ports) return Device(pat, ports)
def y_splitter(lattice_constant: float, def y_splitter(
hole: Pattern, lattice_constant: float,
mirror_periods: int, hole: Pattern,
) -> Device: mirror_periods: int,
) -> Device:
""" """
Generate a `Device` representing a photonic crystal line-defect waveguide y-splitter. Generate a `Device` representing a photonic crystal line-defect waveguide y-splitter.