text
stringlengths 10
968k
| id
stringlengths 14
122
| metadata
dict | __index_level_0__
int64 0
242
|
|---|---|---|---|
from __future__ import annotations
import pathlib
import matplotlib.pyplot as plt
import meep as mp
import numpy as np
import pandas as pd
import pydantic
from gdsfactory.typings import Optional, PathType
from tqdm.auto import tqdm
from gplugins.modes.find_modes import find_modes_waveguide
@pydantic.validate_arguments
def find_neff_vs_width(
width1: float = 0.2,
width2: float = 1.0,
steps: int = 12,
nmodes: int = 4,
wavelength: float = 1.55,
parity=mp.NO_PARITY,
filepath: Optional[PathType] = None,
overwrite: bool = False,
**kwargs,
) -> pd.DataFrame:
"""Sweep waveguide width and compute effective index.
Args:
width1: starting waveguide width in um.
width2: end waveguide width in um.
steps: number of points.
nmodes: number of modes to compute.
wavelength: wavelength in um.
parity: mp.ODD_Y mp.EVEN_X for TE, mp.EVEN_Y for TM.
filepath: Optional filepath to store the results.
overwrite: overwrite file even if exists on disk.
Keyword Args:
slab_thickness: thickness for the waveguide slab in um.
core_material: core material refractive index.
clad_material: clad material refractive index.
sy: simulation region width (um).
sz: simulation region height (um).
resolution: resolution (pixels/um).
"""
if filepath and not overwrite and pathlib.Path(filepath).exists():
return pd.read_csv(filepath)
width = np.linspace(width1, width2, steps)
neff = {mode_number: [] for mode_number in range(1, nmodes + 1)}
for core_width in tqdm(width):
modes = find_modes_waveguide(
wavelength=wavelength,
parity=parity,
nmodes=nmodes,
core_width=core_width,
**kwargs,
)
for mode_number in range(1, nmodes + 1):
mode = modes[mode_number]
neff[mode_number].append(mode.neff)
df = pd.DataFrame(neff)
df["width"] = width
if filepath:
filepath = pathlib.Path(filepath)
cache = filepath.parent
cache.mkdir(exist_ok=True, parents=True)
df.to_csv(filepath, index=False)
return df
def plot_neff_vs_width(df: pd.DataFrame, **kwargs) -> None:
"""Plots effective index versus waveguide width."""
width = df.width
for mode_number, neff in df.items():
if mode_number != "width":
plt.plot(width, neff, ".-", label=str(mode_number))
plt.legend(**kwargs)
plt.xlabel("width (um)")
plt.ylabel("neff")
if __name__ == "__main__":
df = find_neff_vs_width(steps=3, filepath="neff_vs_width.csv")
plot_neff_vs_width(df)
plt.show()
|
gplugins/gplugins/modes/find_neff_vs_width.py/0
|
{
"file_path": "gplugins/gplugins/modes/find_neff_vs_width.py",
"repo_id": "gplugins",
"token_count": 1155
}
| 101
|
from __future__ import annotations
import gplugins.modes as gm
def test_neff_vs_width(dataframe_regression) -> None:
df = gm.find_neff_vs_width(steps=1, resolution=10, cache_path=None)
if dataframe_regression:
dataframe_regression.check(df)
else:
print(df)
if __name__ == "__main__":
test_neff_vs_width(None)
|
gplugins/gplugins/modes/tests/test_neff_vs_width.py/0
|
{
"file_path": "gplugins/gplugins/modes/tests/test_neff_vs_width.py",
"repo_id": "gplugins",
"token_count": 145
}
| 102
|
from __future__ import annotations
def fsr(
ng: float = 4.2,
delta_length: float = 40,
wavelength: float = 1.55,
) -> float:
"""Returns Free Spectral Range.
Args:
ng: group index.
delta_length: in um.
wavelength: in um.
"""
return wavelength**2 / delta_length / ng
if __name__ == "__main__":
print(int(fsr() * 1e3))
|
gplugins/gplugins/photonic_circuit_models/fsr.py/0
|
{
"file_path": "gplugins/gplugins/photonic_circuit_models/fsr.py",
"repo_id": "gplugins",
"token_count": 160
}
| 103
|
import jax.numpy as jnp
import numpy as np
import ray
from gdsfactory.pdk import get_layer_stack
from sax.utils import reciprocal
from gplugins.femwell.mode_solver import compute_cross_section_modes
from gplugins.sax.build_model import Model
@ray.remote(num_cpus=1)
def remote_output_from_inputs(
cross_section,
layer_stack,
wavelength,
num_modes,
order,
radius,
mesh_filename,
resolutions,
overwrite,
with_cache,
):
"""Specific simulator, outside the class for stateless remote execution.
Returns:
new_inputs: numbers from the simulation that we would like to use as model inputs (e.g. wavelength in FDTD)
output_vectors: vectors of reals capturing the output of the simulation
"""
lams, basis, xs = compute_cross_section_modes(
cross_section=cross_section,
layer_stack=layer_stack,
wl=wavelength,
num_modes=num_modes,
order=order,
radius=radius,
mesh_filename="mesh.msh",
resolutions=resolutions,
overwrite=overwrite,
with_cache=True,
)
# Vector of reals
real_neffs = np.real(lams)
imag_neffs = np.imag(lams)
return [], np.hstack((real_neffs, imag_neffs))
class FemwellWaveguideModel(Model):
def __init__(self, **kwargs) -> None:
"""Waveguide model inferred from Femwell mode simula tion."""
super().__init__(**kwargs)
# remote function
self.remote_function = remote_output_from_inputs.options(
num_cpus=self.num_cpus_per_task, # num_gpus=self.num_gpus_per_task
)
# results vector size
self.size_results = self.num_modes
return None
def get_output_from_inputs(self, labels, values, remote_function):
"""Get one output vector from a set of inputs.
How to map parameters to simulation inputs depends on the target simulator.
Arguments:
labels: keys of the parameters
values: values of the parameters
remote_function: ray remote function object to use for the simulation
Returns:
remote function ID for delayed execution
"""
# Prepare this specific input vector
input_dict = dict(zip(labels, [float(value) for value in values]))
# Parse input vector according to parameter type
param_dict, layer_stack_param_dict, litho_param_dict = self.parse_input_dict(
input_dict
)
# Apply required transformations depending on parameter type
input_crosssection = self.trainable_component(param_dict).info["cross_section"]
input_layer_stack = self.perturb_layer_stack(layer_stack_param_dict)
# Define function input given parameter values and transformed layer_stack/component
function_input = dict(
cross_section=input_crosssection,
layer_stack=input_layer_stack,
wavelength=input_dict["wavelength"],
num_modes=self.num_modes,
order=self.simulation_settings["order"],
radius=self.simulation_settings["radius"],
mesh_filename="mesh.msh",
resolutions=self.simulation_settings["resolutions"],
overwrite=self.simulation_settings["overwrite"],
with_cache=True,
)
return remote_function.remote(**function_input)
def sdict(self, input_dict):
"""Returns S-parameters SDict from component using interpolated neff and length."""
# Convert input dict to numeric (find better way to do this)
input_numeric = self.input_dict_to_input_vector(input_dict)
real_neffs = jnp.array(
[self.inference[mode](input_numeric) for mode in range(self.num_modes)]
)
# imag_neffs = jnp.array(
# [
# self.inference[mode](input_numeric)
# for mode in range(self.num_modes, 2 * self.num_modes)
# ]
# ) # currently not used
phase = (
2 * jnp.pi * real_neffs * input_dict["length"] / input_dict["wavelength"]
)
amplitude = jnp.asarray(
10 ** (-input_dict["loss"] * input_dict["length"] / 20), dtype=complex
)
transmission = amplitude * jnp.exp(1j * phase)
sp = {
(f"o1@{mode}", f"o2@{mode}"): transmission[mode]
for mode in range(self.num_modes)
}
return reciprocal(sp)
if __name__ == "__main__":
import gdsfactory as gf
from gdsfactory.cross_section import rib
from gdsfactory.technology import LayerStack
from gplugins.sax.parameter import LayerStackThickness, NamedParameter
c = gf.components.straight(
cross_section=rib(width=2),
length=10,
)
c.show()
layer_stack = get_layer_stack()
filtered_layer_stack = LayerStack(
layers={
k: layer_stack.layers[k]
for k in (
"slab90",
"core",
"box",
"clad",
)
}
)
def trainable_straight_rib(parameters):
return gf.components.straight(cross_section=rib(width=parameters["width"]))
rib_waveguide_model = FemwellWaveguideModel(
trainable_component=trainable_straight_rib,
layer_stack=filtered_layer_stack,
simulation_settings={
"resolutions": {
"core": {"resolution": 0.02, "distance": 2},
"clad": {"resolution": 0.2, "distance": 1},
"box": {"resolution": 0.2, "distance": 1},
"slab90": {"resolution": 0.05, "distance": 1},
},
"overwrite": False,
"order": 1,
"radius": jnp.inf,
},
trainable_parameters={
"width": NamedParameter(
min_value=0.3, max_value=1.0, nominal_value=0.5, step=0.1
),
"wavelength": NamedParameter(
min_value=1.545, max_value=1.555, nominal_value=1.55, step=0.005
),
"core_thickness": LayerStackThickness(
layer_stack=filtered_layer_stack,
min_value=0.19,
max_value=0.25,
nominal_value=0.22,
layername="core",
step=0.3,
),
},
non_trainable_parameters={
"length": NamedParameter(nominal_value=10),
"loss": NamedParameter(nominal_value=1),
},
num_modes=4,
)
# Sweep corners
# input_vectors, output_vectors = rib_waveguide_model.get_model_input_output(
# type="arange"
# )
# Sweep steps
# input_vectors, output_vectors = rib_waveguide_model.get_all_inputs_outputs()
interpolator = rib_waveguide_model.set_nd_nd_interp()
# interpolator = rib_waveguide_model.set_mlp_interp()
params = jnp.stack(
jnp.broadcast_arrays(
jnp.asarray([0.3, 0.55, 1.0]),
jnp.asarray([1.55, 1.55, 1.55]),
jnp.asarray([0.22, 0.22, 0.22]),
),
0,
)
params_arr = [0.5, 1.55, 0.22, 10]
params_dict = {
"width": 0.5,
"wavelength": 1.55,
"core_thickness": 0.22,
"length": 10,
"loss": 1,
}
print(rib_waveguide_model.sdict(params_dict))
import matplotlib.pyplot as plt
widths = jnp.linspace(0.3, 1.0, 100)
plt.plot(widths)
|
gplugins/gplugins/sax/integrations/femwell_waveguide_model.py/0
|
{
"file_path": "gplugins/gplugins/sax/integrations/femwell_waveguide_model.py",
"repo_id": "gplugins",
"token_count": 3444
}
| 104
|
from pathlib import Path
import bokeh.io
import gdsfactory as gf
import ipywidgets as widgets
import yaml
from gdsfactory.picmodel import (
PicYamlConfiguration,
Route,
RouteSettings,
SchematicConfiguration,
)
from gplugins.schematic_editor import circuitviz
class SchematicEditor:
def __init__(self, filename: str | Path, pdk: gf.Pdk | None = None) -> None:
"""An interactive Schematic editor, meant to be used from a Jupyter Notebook.
Args:
filename: the filename or path to use for the input/output schematic
pdk: the PDK to use (uses the current active PDK if None)
"""
filepath = filename if isinstance(filename, Path) else Path(filename)
self.path = filepath
self.pdk = pdk or gf.get_active_pdk()
self.component_list = list(gf.get_active_pdk().cells.keys())
self.on_instance_added = []
self.on_instance_removed = []
self.on_settings_updated = []
self.on_nets_modified = []
self._notebook_handle = None
self._inst_boxes = []
self._connected_ports = {}
if filepath.is_file():
self.load_netlist()
else:
self._schematic = SchematicConfiguration(
instances={}, schematic_placements={}, nets=[], ports={}
)
self._instance_grid = widgets.VBox()
self._net_grid = widgets.VBox()
self._port_grid = widgets.VBox()
first_inst_box = self._get_instance_selector()
first_inst_box.children[0].observe(self._add_row_when_full, names=["value"])
first_inst_box.children[1].observe(
self._on_instance_component_modified, names=["value"]
)
self._instance_grid.children += (first_inst_box,)
first_net_box = self._get_net_selector()
first_net_box.children[0].observe(self._add_net_row_when_full, names=["value"])
self._net_grid.children += (first_net_box,)
for row in self._net_grid.children:
for child in row.children:
child.observe(self._on_net_modified, names=["value"])
# write netlist whenever the netlist changes, in any way
self.on_instance_added.append(self.write_netlist)
self.on_settings_updated.append(self.write_netlist)
self.on_nets_modified.append(self.write_netlist)
self.on_instance_removed.append(self.write_netlist)
# events triggered when instances are added
self.on_instance_added.append(self._update_instance_options)
self.on_instance_added.append(self._make_instance_removable)
def _get_instance_selector(self, inst_name=None, component_name=None):
component_selector = widgets.Combobox(
placeholder="Pick a component",
options=self.component_list,
ensure_option=True,
disabled=False,
)
instance_box = widgets.Text(placeholder="Enter a name", disabled=False)
component_selector._instance_selector = instance_box
can_remove = False
if inst_name:
instance_box.value = inst_name
if component_name:
component_selector.value = component_name
can_remove = True
remove_button = widgets.Button(
description="Remove",
icon="xmark",
disabled=(not can_remove),
tooltip="Remove this instance from the schematic",
button_style="",
)
remove_button.on_click(self._on_remove_button_clicked)
row = widgets.Box([instance_box, component_selector, remove_button])
row._component_selector = component_selector
row._instance_box = instance_box
row._remove_button = remove_button
remove_button._row = row
instance_box._row = row
component_selector._row = row
return row
def _get_port_selector(self, port_name: str | None = None, port: str | None = None):
instance_port_selector = widgets.Text(
placeholder="InstanceName:PortName", disabled=False
)
port_name_box = widgets.Text(placeholder="Port name", disabled=False)
instance_port_selector._instance_selector = port_name_box
can_remove = False
if port_name:
port_name_box.value = port_name
if port:
instance_port_selector.value = port
# can_remove = True
can_remove = False
remove_button = widgets.Button(
description="Remove",
icon="xmark",
disabled=(not can_remove),
tooltip="Remove this port from the schematic",
button_style="",
)
remove_button.on_click(self._on_remove_button_clicked)
row = widgets.Box([port_name_box, instance_port_selector, remove_button])
row._component_selector = instance_port_selector
row._instance_box = port_name_box
row._remove_button = remove_button
remove_button._row = row
port_name_box._row = row
instance_port_selector._row = row
return row
def _update_instance_options(self, **kwargs) -> None:
inst_names = self._schematic.instances.keys()
for inst_box in self._inst_boxes:
inst_box.options = list(inst_names)
def _make_instance_removable(self, instance_name, **kwargs) -> None:
for row in self._instance_grid.children:
if row._instance_box.value == instance_name:
row._remove_button.disabled = False
return
def _get_net_selector(self, inst1=None, port1=None, inst2=None, port2=None):
inst_names = list(self._schematic.instances.keys())
inst1_selector = widgets.Combobox(
placeholder="inst1", options=inst_names, ensure_option=True, disabled=False
)
inst2_selector = widgets.Combobox(
placeholder="inst2", options=inst_names, ensure_option=True, disabled=False
)
self._inst_boxes.extend([inst1_selector, inst2_selector])
port1_selector = widgets.Text(placeholder="port1", disabled=False)
port2_selector = widgets.Text(placeholder="port2", disabled=False)
if inst1:
inst1_selector.value = inst1
if inst2:
inst2_selector.value = inst2
if port1:
port1_selector.value = port1
if port2:
port2_selector.value = port2
return widgets.Box(
[inst1_selector, port1_selector, inst2_selector, port2_selector]
)
def _add_row_when_full(self, change) -> None:
if change["old"] == "" and change["new"] != "":
this_box = change["owner"]
last_box = self._instance_grid.children[-1].children[0]
if this_box is last_box:
new_row = self._get_instance_selector()
self._instance_grid.children += (new_row,)
new_row.children[0].observe(self._add_row_when_full, names=["value"])
new_row.children[1].observe(
self._on_instance_component_modified, names=["value"]
)
new_row._associated_component = None
def _add_net_row_when_full(self, change) -> None:
if change["old"] == "" and change["new"] != "":
this_box = change["owner"]
last_box = self._net_grid.children[-1].children[0]
if this_box is last_box:
new_row = self._get_net_selector()
self._net_grid.children += (new_row,)
new_row.children[0].observe(
self._add_net_row_when_full, names=["value"]
)
for child in new_row.children:
child.observe(self._on_net_modified, names=["value"])
new_row._associated_component = None
def _update_schematic_plot(self, **kwargs) -> None:
circuitviz.update_schematic_plot(
schematic=self._schematic,
instances=self.symbols,
)
def _on_instance_component_modified(self, change) -> None:
this_box = change["owner"]
inst_box = this_box._instance_selector
inst_name = inst_box.value
component_name = this_box.value
if change["old"] == "":
if change["new"] != "":
self.add_instance(instance_name=inst_name, component=component_name)
elif change["new"] != change["old"]:
self.update_component(instance=inst_name, component=component_name)
def _on_remove_button_clicked(self, button) -> None:
row = button._row
self.remove_instance(instance_name=row._instance_box.value)
self._instance_grid.children = tuple(
child for child in self._instance_grid.children if child is not row
)
def _get_data_from_row(self, row):
inst_name, component_name = (w.value for w in row.children)
return {"instance_name": inst_name, "component_name": component_name}
def _get_instance_data(self):
inst_data = [
self._get_data_from_row(row) for row in self._instance_grid.children
]
inst_data = [d for d in inst_data if d["instance_name"] != ""]
return inst_data
def _get_net_from_row(self, row):
return [c.value for c in row.children]
def _get_net_data(self):
net_data = [self._get_net_from_row(row) for row in self._net_grid.children]
net_data = [d for d in net_data if "" not in d]
return net_data
def _on_net_modified(self, change) -> None:
if change["new"] == change["old"]:
return
net_data = self._get_net_data()
new_nets = [[f"{n[0]},{n[1]}", f"{n[2]},{n[3]}"] for n in net_data]
connected_ports = {}
for n1, n2 in new_nets:
connected_ports[n1] = n2
connected_ports[n2] = n1
self._connected_ports = connected_ports
old_nets = self._schematic.nets
self._schematic.nets = new_nets
for callback in self.on_nets_modified:
callback(old_nets=old_nets, new_nets=new_nets)
@property
def instance_widget(self):
return self._instance_grid
@property
def net_widget(self):
return self._net_grid
@property
def port_widget(self):
return self._port_grid
def visualize(self) -> None:
circuitviz.show_netlist(self.schematic, self.symbols, self.path)
self.on_instance_added.append(self._update_schematic_plot)
self.on_settings_updated.append(self._update_schematic_plot)
self.on_nets_modified.append(self._update_schematic_plot)
self.on_instance_removed.append(self._update_schematic_plot)
@property
def instances(self):
insts = {}
inst_data = self._schematic.instances
for inst_name, inst in inst_data.items():
component_spec = inst.dict()
# if component_spec['settings'] is None:
# component_spec['settings'] = {}
# validates the settings
insts[inst_name] = gf.get_component(component_spec)
return insts
@property
def symbols(self):
insts = {}
inst_data = self._schematic.instances
for inst_name, inst in inst_data.items():
component_spec = inst.dict()
insts[inst_name] = self.pdk.get_symbol(component_spec)
return insts
def add_instance(self, instance_name: str, component: str | gf.Component) -> None:
self._schematic.add_instance(name=instance_name, component=component)
for callback in self.on_instance_added:
callback(instance_name=instance_name)
def remove_instance(self, instance_name: str) -> None:
self._schematic.instances.pop(instance_name)
if instance_name in self._schematic.placements:
self._schematic.placements.pop(instance_name)
for callback in self.on_instance_removed:
callback(instance_name=instance_name)
def update_component(self, instance, component) -> None:
self._schematic.instances[instance].component = component
self.update_settings(instance=instance, clear_existing=True)
def update_settings(
self, instance, clear_existing: bool = False, **settings
) -> None:
old_settings = self._schematic.instances[instance].settings.copy()
if clear_existing:
self._schematic.instances[instance].settings.clear()
if settings:
self._schematic.instances[instance].settings.update(settings)
for callback in self.on_settings_updated:
callback(
instance_name=instance, settings=settings, old_settings=old_settings
)
def add_net(self, inst1, port1, inst2, port2):
p1 = f"{inst1},{port1}"
p2 = f"{inst2},{port2}"
if p1 in self._connected_ports:
if self._connected_ports[p1] == p2:
return
current_port = self._connected_ports[p1]
raise ValueError(
f"{p1} is already connected to {current_port}. Can't connect to {p2}"
)
self._connected_ports[p1] = p2
self._connected_ports[p2] = p1
old_nets = self._schematic.nets.copy()
self._schematic.nets.append([p1, p2])
new_row = self._get_net_selector(
inst1=inst1, inst2=inst2, port1=port1, port2=port2
)
existing_rows = self._net_grid.children
new_rows = existing_rows[:-1] + (new_row, existing_rows[-1])
self._net_grid.children = new_rows
for callback in self.on_nets_modified:
callback(old_nets=old_nets, new_nets=self._schematic.nets)
def get_netlist(self):
return self._schematic.dict()
@property
def schematic(self):
return self._schematic
def write_netlist(self, **kwargs) -> None:
netlist = self.get_netlist()
with open(self.path, mode="w") as f:
yaml.dump(netlist, f, default_flow_style=None, sort_keys=False)
def load_netlist(self) -> None:
with open(self.path) as f:
netlist = yaml.safe_load(f)
schematic = SchematicConfiguration.parse_obj(netlist)
self._schematic = schematic
# process instances
instances = netlist["instances"]
nets = netlist.get("nets", [])
new_rows = []
for inst_name, inst in instances.items():
component_name = inst["component"]
new_row = self._get_instance_selector(
inst_name=inst_name, component_name=component_name
)
new_row.children[0].observe(self._add_row_when_full, names=["value"])
new_row.children[1].observe(
self._on_instance_component_modified, names=["value"]
)
new_rows.append(new_row)
self._instance_grid = widgets.VBox(new_rows)
# process nets
unpacked_nets = []
net_rows = []
for net in nets:
unpacked_net = []
for net_entry in net:
inst_name, port_name = net_entry.split(",")
unpacked_net.extend([inst_name, port_name])
unpacked_nets.append(unpacked_net)
net_rows.append(self._get_net_selector(*unpacked_net))
self._connected_ports[net[0]] = net[1]
self._connected_ports[net[1]] = net[0]
self._net_grid = widgets.VBox(net_rows)
# process ports
ports = netlist.get("ports", {})
schematic.ports = ports
new_rows = []
for port_name, port in ports.items():
new_row = self._get_port_selector(port_name=port_name, port=port)
new_row.children[0].observe(self._add_row_when_full, names=["value"])
new_row.children[1].observe(
self._on_instance_component_modified, names=["value"]
)
new_rows.append(new_row)
self._port_grid = widgets.VBox(new_rows)
def instantiate_layout(
self,
output_filename,
default_router="get_bundle",
default_cross_section="xs_sc",
):
schematic = self._schematic
routes = {}
for inet, net in enumerate(schematic.nets):
route = Route(
routing_strategy=default_router,
links={net[0]: net[1]},
settings=RouteSettings(cross_section=default_cross_section),
)
routes[f"r{inet}"] = route
pic_conf = PicYamlConfiguration(
instances=schematic.instances,
placements=schematic.placements,
routes=routes,
ports=schematic.ports,
)
pic_conf.to_yaml(output_filename)
return pic_conf
def save_schematic_html(
self, filename: str | Path, title: str | None = None
) -> None:
"""Saves the schematic visualization to a standalone html file (read-only).
Args:
filename: the (*.html) filename to write to
title: title for the output page
"""
filename = Path(filename)
if title is None:
title = f"{filename.stem} Schematic"
if "doc" not in circuitviz.data:
self.visualize()
if "doc" in circuitviz.data:
bokeh.io.save(circuitviz.data["doc"], filename=filename, title=title)
else:
raise ValueError(
"Unable to save the schematic to a standalone html file! Has the visualization been loaded yet?"
)
if __name__ == "__main__":
from gdsfactory.config import PATH
se = SchematicEditor(PATH.notebooks / "test.schem.yml")
print(se.schematic)
|
gplugins/gplugins/schematic_editor/schematic_editor.py/0
|
{
"file_path": "gplugins/gplugins/schematic_editor/schematic_editor.py",
"repo_id": "gplugins",
"token_count": 8061
}
| 105
|
from __future__ import annotations
import pathlib
import gdsfactory as gf
from jsondiff import diff
from omegaconf import OmegaConf
import gplugins.tidy3d as gt
# from gplugins.tidy3d.get_results import get_sim_hash
# def test_simulation_hash() -> None:
# component = gf.components.straight(length=3)
# sim = gt.get_simulation(component=component)
# sim_hash = get_sim_hash(sim)
# sim_hash_reference = "4b0cd0b69d0e1c32a1bf30e1f1ea5b27"
# assert sim_hash == sim_hash_reference, f"sim_hash_reference = {sim_hash!r}"
def test_simulation(overwrite: bool = True) -> None:
"""Export sim in JSON, and then load it again."""
dirpath = pathlib.Path(__file__).parent
component = gf.components.straight(length=3)
sim = gt.get_simulation(component=component)
ref_path = dirpath / "sim_ref.yaml"
run_path = dirpath / "sim_run.yaml"
if overwrite:
sim.to_file(str(ref_path)) # uncomment to overwrite material
sim.to_file(str(run_path))
dref = OmegaConf.load(ref_path)
drun = OmegaConf.load(run_path)
d = diff(dref, drun)
assert len(d) == 0, d
if __name__ == "__main__":
# test_simulation_hash()
test_simulation(overwrite=True)
# test_simulation(overwrite=True)
# test_simulation()
# component = gf.components.straight(length=3)
# sim = gt.get_simulation(component=component)
# sim.to_file("sim_ref.yaml")
# sim.to_file("sim_run.yaml")
# dref = OmegaConf.load("sim_ref.yaml")
# drun = OmegaConf.load("sim_run.yaml")
# d = diff(dref, drun)
|
gplugins/gplugins/tidy3d/tests/tests_sparameters/test_simulation.py/0
|
{
"file_path": "gplugins/gplugins/tidy3d/tests/tests_sparameters/test_simulation.py",
"repo_id": "gplugins",
"token_count": 641
}
| 106
|
resolution: 30
port_symmetries:
o2@0,o1@0:
- o1@0,o2@0
wavelength_start: 1.5
wavelength_stop: 1.6
wavelength_points: 50
port_margin: 2
port_monitor_offset: -0.1
port_source_offset: -0.1
dispersive: false
ymargin_top: 0.0
ymargin_bot: 3.0
xmargin_left: 0
xmargin_right: 3.0
is_3d: false
layer_stack:
substrate:
layer:
- 99999
- 0
thickness: 10.0
thickness_tolerance: null
zmin: -13.0
zmin_tolerance: null
material: si
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 99
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
box:
layer:
- 99999
- 0
thickness: 3.0
thickness_tolerance: null
zmin: -3.0
zmin_tolerance: null
material: sio2
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 99
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
core:
layer:
- 1
- 0
thickness: 0.22
thickness_tolerance: null
zmin: 0.0
zmin_tolerance: null
material: si
sidewall_angle: 10.0
sidewall_angle_tolerance: null
width_to_z: 0.5
z_to_bias: null
mesh_order: 2
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
shallow_etch:
layer:
- 2
- 6
thickness: 0.07
thickness_tolerance: null
zmin: 0.0
zmin_tolerance: null
material: si
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 1
layer_type: etch
mode: null
into:
- core
doping_concentration: null
resistivity: null
bias: null
derived_layer:
- 2
- 0
info: {}
deep_etch:
layer:
- 3
- 6
thickness: 0.13
thickness_tolerance: null
zmin: 0.0
zmin_tolerance: null
material: si
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 1
layer_type: etch
mode: null
into:
- core
doping_concentration: null
resistivity: null
bias: null
derived_layer:
- 3
- 0
info: {}
clad:
layer:
- 99999
- 0
thickness: 3.0
thickness_tolerance: null
zmin: 0.0
zmin_tolerance: null
material: sio2
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 10
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
slab150:
layer:
- 2
- 0
thickness: 0.15
thickness_tolerance: null
zmin: 0.0
zmin_tolerance: null
material: si
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 3
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
slab90:
layer:
- 3
- 0
thickness: 0.09
thickness_tolerance: null
zmin: 0.0
zmin_tolerance: null
material: si
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 2
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
nitride:
layer:
- 34
- 0
thickness: 0.35000000000000003
thickness_tolerance: null
zmin: 0.32
zmin_tolerance: null
material: sin
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 2
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
ge:
layer:
- 5
- 0
thickness: 0.5
thickness_tolerance: null
zmin: 0.22
zmin_tolerance: null
material: ge
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 1
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
undercut:
layer:
- 6
- 0
thickness: -5.0
thickness_tolerance: null
zmin: -3.0
zmin_tolerance: null
material: air
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias:
- - 0.0
- 0.3
- 0.6
- 0.8
- 0.9
- 1.0
- - 0.0
- -0.5
- -1.0
- -1.5
- -2.0
- -2.5
mesh_order: 1
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
via_contact:
layer:
- 40
- 0
thickness: 1.01
thickness_tolerance: null
zmin: 0.09
zmin_tolerance: null
material: Aluminum
sidewall_angle: -10.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 1
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
metal1:
layer:
- 41
- 0
thickness: 0.7000000000000001
thickness_tolerance: null
zmin: 1.1
zmin_tolerance: null
material: Aluminum
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 2
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
heater:
layer:
- 47
- 0
thickness: 0.75
thickness_tolerance: null
zmin: 1.1
zmin_tolerance: null
material: TiN
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 1
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
via1:
layer:
- 44
- 0
thickness: 0.49999999999999956
thickness_tolerance: null
zmin: 1.8000000000000003
zmin_tolerance: null
material: Aluminum
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 2
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
metal2:
layer:
- 45
- 0
thickness: 0.7000000000000001
thickness_tolerance: null
zmin: 2.3
zmin_tolerance: null
material: Aluminum
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 2
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
via2:
layer:
- 43
- 0
thickness: 0.20000000000000018
thickness_tolerance: null
zmin: 3.0
zmin_tolerance: null
material: Aluminum
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 1
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
metal3:
layer:
- 49
- 0
thickness: 2.0
thickness_tolerance: null
zmin: 3.2
zmin_tolerance: null
material: Aluminum
sidewall_angle: 0.0
sidewall_angle_tolerance: null
width_to_z: 0.0
z_to_bias: null
mesh_order: 2
layer_type: grow
mode: null
into: null
doping_concentration: null
resistivity: null
bias: null
derived_layer: null
info: {}
component:
ports:
o1:
name: o1
width: 0.5
center:
- 0.0
- 0.0
orientation: 180
layer:
- 1
- 0
port_type: optical
shear_angle: null
o2:
name: o2
width: 0.5
center:
- 3.0
- 3.0
orientation: 90
layer:
- 1
- 0
port_type: optical
shear_angle: null
name: bend_euler_radius3
settings:
name: bend_euler_radius3
module: gdsfactory.components.bend_euler
function_name: bend_euler
info:
length: 4.99
dy: 3.0
radius_min: 2.118
radius: 3.0
width: 0.5
settings:
width: 0.5
offset: 0
layer: WG
width_wide: null
auto_widen: false
auto_widen_minimum_length: 200.0
taper_length: 10.0
radius: 3
sections: null
port_names:
- o1
- o2
port_types:
- optical
- optical
gap: 3.0
min_length: 0.01
start_straight_length: 0.01
end_straight_length: 0.01
snap_to_grid: null
bbox_layers: null
bbox_offsets: null
cladding_layers: null
cladding_offsets: null
cladding_simplify: null
info: null
decorator: null
add_pins:
function: add_pins
settings:
function:
function: add_pin_rectangle_inside
settings:
pin_length: 0.001
layer_label: null
add_bbox: null
mirror: false
name: strip
function_name: cross_section
info_version: 2
full:
angle: 90.0
p: 0.5
with_arc_floorplan: true
npoints: null
direction: ccw
with_bbox: true
cross_section: strip
radius: 3
changed:
radius: 3
default:
angle: 90.0
p: 0.5
with_arc_floorplan: true
npoints: null
direction: ccw
with_bbox: true
cross_section: strip
child: null
compute_time_seconds: 25.49888777732849
compute_time_minutes: 0.42498146295547484
|
gplugins/notebooks/data/bend90_meep.yml/0
|
{
"file_path": "gplugins/notebooks/data/bend90_meep.yml",
"repo_id": "gplugins",
"token_count": 4974
}
| 107
|
<jupyter_start><jupyter_text>DataprepWhen building a reticle sometimes you want to do boolean operations. This is usually known as dataprep.You can do this at the component level or at the top reticle assembled level.This tutorial is focusing on cleaning DRC on masks that have already been created.<jupyter_code>import gdsfactory as gf
from gdsfactory.generic_tech.layer_map import LAYER
import gplugins.klayout.dataprep as dp<jupyter_output><empty_output><jupyter_text>You can manipulate layers using the klayout LayerProcessor to create a `RegionCollection` to operate on different layers.The advantage is that this can easily clean up routing, proximity effects, acute angles.<jupyter_code>c = gf.Component()
ring = c << gf.components.coupler_ring(radius=20)
c.write_gds("input.gds")
d = dp.RegionCollection(gdspath="input.gds")
c.plot()<jupyter_output><empty_output><jupyter_text>Copy layersYou can access each layer as a dict.<jupyter_code>d[LAYER.N] = d[
LAYER.WG
].copy() # make sure you add the copy to create a copy of the layer
d.show()
d.plot()<jupyter_output><empty_output><jupyter_text>Remove layers<jupyter_code>d[LAYER.N].clear()
d.show()
d.plot()<jupyter_output><empty_output><jupyter_text>SizeYou can size layers, positive numbers grow and negative shrink.<jupyter_code>d[LAYER.SLAB90] = d[LAYER.WG] + 2 # size layer by 4 um
d.show()
d.plot()<jupyter_output><empty_output><jupyter_text>Over / UnderTo avoid acute angle DRC errors you can grow and shrink polygons. This will remove regions smaller<jupyter_code>d[LAYER.SLAB90] += 2 # size layer by 4 um
d[LAYER.SLAB90] -= 2 # size layer by 2 um
d.plot()<jupyter_output><empty_output><jupyter_text>SmoothYou can smooth using [RDP](https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm)<jupyter_code>d[LAYER.SLAB90].smooth(
1 * 1e3
) # smooth by 1um, Notice that klayout units are in DBU (database units) in this case 1nm, so 1um = 1e3
d.plot()<jupyter_output><empty_output><jupyter_text>BooleansYou can derive layers and do boolean operations.<jupyter_code>d[LAYER.DEEP_ETCH] = d[LAYER.SLAB90] - d[LAYER.WG]
d.plot()<jupyter_output><empty_output><jupyter_text>Fill<jupyter_code>import gdsfactory as gf
import kfactory as kf
from kfactory.utils.fill import fill_tiled
c = kf.KCell("ToFill")
c.shapes(kf.kcl.layer(1, 0)).insert(
kf.kdb.DPolygon.ellipse(kf.kdb.DBox(5000, 3000), 512)
)
c.shapes(kf.kcl.layer(10, 0)).insert(
kf.kdb.DPolygon(
[kf.kdb.DPoint(0, 0), kf.kdb.DPoint(5000, 0), kf.kdb.DPoint(5000, 3000)]
)
)
fc = kf.KCell("fill")
fc.shapes(fc.kcl.layer(2, 0)).insert(kf.kdb.DBox(20, 40))
fc.shapes(fc.kcl.layer(3, 0)).insert(kf.kdb.DBox(30, 15))
# fill.fill_tiled(c, fc, [(kf.kcl.layer(1,0), 0)], exclude_layers = [(kf.kcl.layer(10,0), 100), (kf.kcl.layer(2,0), 0), (kf.kcl.layer(3,0),0)], x_space=5, y_space=5)
fill_tiled(
c,
fc,
[(kf.kcl.layer(1, 0), 0)],
exclude_layers=[
(kf.kcl.layer(10, 0), 100),
(kf.kcl.layer(2, 0), 0),
(kf.kcl.layer(3, 0), 0),
],
x_space=5,
y_space=5,
)
gdspath = "mzi_fill.gds"
c.write(gdspath)
c.plot()<jupyter_output><empty_output>
|
gplugins/notebooks/klayout_dataprep.ipynb/0
|
{
"file_path": "gplugins/notebooks/klayout_dataprep.ipynb",
"repo_id": "gplugins",
"token_count": 1338
}
| 108
|
<jupyter_start><jupyter_text>Path length analysisYou can use the `report_pathlenghts` functionality to get a detailed CSV report and interactive visualization about the routes in your PIC.<jupyter_code>import gdsfactory as gf
xs_top = [0, 10, 20, 40, 50, 80]
pitch = 127.0
N = len(xs_top)
xs_bottom = [(i - N / 2) * pitch for i in range(N)]
layer = (1, 0)
top_ports = [
gf.Port(f"top_{i}", center=(xs_top[i], 0), width=0.5, orientation=270, layer=layer)
for i in range(N)
]
bot_ports = [
gf.Port(
f"bot_{i}",
center=(xs_bottom[i], -300),
width=0.5,
orientation=90,
layer=layer,
)
for i in range(N)
]
c = gf.Component(name="connect_bundle_separation")
routes = gf.routing.get_bundle(
top_ports, bot_ports, separation=5.0, end_straight_length=100
)
for route in routes:
c.add(route.references)
c.plot()<jupyter_output><empty_output><jupyter_text>Let's quickly demonstrate our new cross-sections and transition component.<jupyter_code>from pathlib import Path
from gplugins.path_length_analysis.path_length_analysis import report_pathlengths
report_pathlengths(
pic=c,
result_dir=Path("rib_strip_pathlengths"),
visualize=True,
)<jupyter_output><empty_output>
|
gplugins/notebooks/path_length_analysis.ipynb/0
|
{
"file_path": "gplugins/notebooks/path_length_analysis.ipynb",
"repo_id": "gplugins",
"token_count": 503
}
| 109
|
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
[build-system]
build-backend = "flit_core.buildapi"
requires = ["flit_core >=3.2,<4"]
[lint.per-file-ignores]
"docs/notebooks/*.py" = ["F821", 'E402', 'F405', 'F403']
"docs/notebooks/meep_01_sparameters.py" = ["F821", 'E402']
"docs/notebooks/tcad_02_analytical_process.py" = ["F821", 'E402', 'F405', 'F403']
[lint.pydocstyle]
convention = "google"
[project]
authors = [
{name = "gdsfactory", email = "contact@gdsfactory.com"}
]
classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Operating System :: OS Independent"
]
dependencies = [
"gdsfactory>=7.10.1",
"pint",
"tqdm"
]
description = "gdsfactory plugins"
keywords = ["python"]
license = {file = "LICENSE"}
name = "gplugins"
readme = "README.md"
requires-python = ">=3.10"
version = "0.11.0"
[project.optional-dependencies]
dagster = ["dagster", "dagit"]
dev = [
"pre-commit",
"pytest",
"pytest-cov",
"pytest_regressions",
"jsondiff",
"mypy",
"pyswarms",
"autograd",
"hyperopt",
"tbump",
"towncrier",
"ray"
]
devsim = [
"devsim",
"pyvista<=0.40",
"tidy3d==2.5.2"
]
docs = [
"jupytext",
"matplotlib",
"jupyter-book==1.0.0",
"pyvista[jupyter]<=0.40"
]
femwell = [
"femwell>=0.1.6,<0.2",
"meshwell>=1.0.7,<=1.1"
]
gmsh = [
"gmsh==4.12.2",
"h5py",
"mapbox_earcut",
"meshio",
"pygmsh",
"pyvista<=0.40",
"trimesh",
"shapely",
"meshwell>=1.0.7,<=1.1"
]
klayout = [
"klayout",
"pyvis<=0.3.1"
]
meow = [
"jax==0.4.23",
"jaxlib==0.4.23",
"meow-sim>=0.9.0,<0.11.0",
"tidy3d==2.5.2"
]
sax = [
"jax<=0.4.23",
"jaxlib<=0.4.23",
"sax>=0.12.1,<0.13.0",
"scikit-learn",
"pyvis<=0.3.1"
]
schematic = [
"bokeh",
"natsort"
]
tidy3d = [
"tidy3d==2.5.2",
"meshio",
"meshwell>=1.0.7,<=1.1"
]
vlsir = [
"vlsir>=4.0.0,<6.0.0",
"vlsirtools>=4.0.0,<6.0.0"
]
[tool.codespell]
ignore-words-list = 'te, te/tm, te, ba, fpr, fpr_spacing, ro, nd, donot, schem, Ue'
skip = 'notebooks/palace_02_fullwave.ipynb'
[tool.mypy]
python_version = "3.10"
strict = true
[tool.pylsp-mypy]
enabled = true
live_mode = true
strict = true
[tool.pyright]
reportUnusedExpression = false
[tool.pytest.ini_options]
addopts = '--tb=short'
norecursedirs = [
"extra/*.py",
'gplugins/dagster',
'gplugins/devsim',
'gplugins/sax/integrations',
'gplugins/tidy3d/tests/tests_sparameters',
'gplugins/fdtdz',
'gplugins/elmer'
]
python_files = ["gplugins/*.py", "notebooks/*.ipynb", "tests/*.py"]
testpaths = ["gplugins/", "tests"]
[tool.ruff]
fix = true
lint.ignore = [
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"C901", # too complex
"B905", # `zip()` without an explicit `strict=` parameter
"C408", # C408 Unnecessary `dict` call (rewrite as a literal)
"E402", # module level import not at top of file
"B018", # found useless expression
"B028" # no explicit stacklevel
]
lint.select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"C", # flake8-comprehensions
"B", # flake8-bugbear
"T10", # flake8-debugger
"UP"
]
[tool.setuptools.package-data]
mypkg = ["*.csv", "*.yaml"]
[tool.setuptools.packages]
find = {}
[tool.tbump]
[[tool.tbump.before_commit]]
cmd = "towncrier build --yes --version {new_version}"
name = "create & check changelog"
[[tool.tbump.before_commit]]
cmd = "git add CHANGELOG.md"
name = "create & check changelog"
[[tool.tbump.before_commit]]
cmd = "grep -q -F {new_version} CHANGELOG.md"
name = "create & check changelog"
[[tool.tbump.file]]
src = "README.md"
[[tool.tbump.file]]
src = "pyproject.toml"
[[tool.tbump.file]]
src = "gplugins/__init__.py"
[tool.tbump.git]
message_template = "Bump to {new_version}"
tag_template = "v{new_version}"
[tool.tbump.version]
current = "0.11.0"
regex = '''
(?P<major>\d+)
\.
(?P<minor>\d+)
\.
(?P<patch>\d+)
'''
[tool.towncrier]
directory = ".changelog.d"
filename = "CHANGELOG.md"
issue_format = "[#{issue}](https://github.com/gdsfactory/gplugins/issues/{issue})"
start_string = "<!-- towncrier release notes start -->\n"
template = ".changelog.d/changelog_template.jinja"
title_format = "## [{version}](https://github.com/gdsfactory/gplugins/releases/tag/v{version}) - {project_date}"
underlines = ["", "", ""]
[[tool.towncrier.type]]
directory = "security"
name = "Security"
showcontent = true
[[tool.towncrier.type]]
directory = "removed"
name = "Removed"
showcontent = true
[[tool.towncrier.type]]
directory = "deprecated"
name = "Deprecated"
showcontent = true
[[tool.towncrier.type]]
directory = "added"
name = "Added"
showcontent = true
[[tool.towncrier.type]]
directory = "changed"
name = "Changed"
showcontent = true
[[tool.towncrier.type]]
directory = "fixed"
name = "Fixed"
showcontent = true
|
gplugins/pyproject.toml/0
|
{
"file_path": "gplugins/pyproject.toml",
"repo_id": "gplugins",
"token_count": 2207
}
| 110
|
"""CLI interface for kfactory.
Use `kf --help` for more info.
"""
from typing import Annotated
# import click
import typer
from .. import __version__
from .runshow import run, show
from .sea import app as sea
app = typer.Typer(name="kf")
app.command()(run)
app.command()(show)
app.add_typer(sea)
@app.callback(invoke_without_command=True)
def version_callback(
version: Annotated[
bool, typer.Option("--version", "-V", help="Show version of the CLI")
] = False,
) -> None:
"""Show the version of the cli."""
if version:
print(f"KFactory CLI Version: {__version__}")
raise typer.Exit()
|
kfactory/src/kfactory/cli/__init__.py/0
|
{
"file_path": "kfactory/src/kfactory/cli/__init__.py",
"repo_id": "kfactory",
"token_count": 240
}
| 111
|
"""Create 1D or 2D (flex) grids in KCells."""
from __future__ import annotations
from collections.abc import Sequence
from typing import Literal, cast
from . import kdb
from .kcell import Instance, KCell
def grid_dbu(
target: KCell,
kcells: Sequence[KCell | None] | Sequence[Sequence[KCell | None]],
spacing: int | tuple[int, int],
target_trans: kdb.Trans = kdb.Trans(),
shape: tuple[int, int] | None = None,
align_x: Literal["origin", "xmin", "xmax", "center"] = "center",
align_y: Literal["origin", "ymin", "ymax", "center"] = "center",
rotation: Literal[0, 1, 2, 3] = 0,
mirror: bool = False,
) -> list[list[Instance | None]]:
"""Create a grid of instances.
A grid uses the bounding box of the biggest width and biggest height of any bounding
boxes inserted into the grid.
to this bounding box a spacing is applied in x and y.
```
spacing[0] or spacing
◄─►
┌──────────────────┐ ┌────┬─────┬─────┐ ┌────────────────┐ ┌──────────────────┐ ▲
│ │ │ │ │ │ │ │ │ │ │
│ ┌────┐ │ │ │ │ │ │ │ │ ┌──────┐ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ big │ │ │ ┌───────┐ │ │ │ │ │ │
│ │ │ │ │ │ comp│ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ y │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ max bbox y
│ └────┘ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ └──────┘ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ └───────┘ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │
▲└──────────────────┘ └────┴─────┴─────┘ └────────────────┘ └──────────────────┘ ▼
│spacing[1] or spacing
▼┌──────────────────┐ ┌────────────────┐ ┌────────────────┐ ┌──────────────────┐
│ │ │ │ │ │ │ │
│ │ │ │ │ ┌────┐ │ │ ┌───┐ │
├──────────────────┤ │ ┌───────────┐ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │
│ big comp x │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │
├──────────────────┤ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ └───────────┘ │ │ └────┘ │ │ └───┘ │
│ │ │ │ │ │ │ │
└──────────────────┘ └────────────────┘ └────────────────┘ └──────────────────┘
◄──────────────────►
max bbox x
```
Args:
target: Target KCell.
kcells: Sequence or sequence of sequence of KCells to add to the grid
spacing: Value or tuple of value (different x/y) for spacing of the grid. [dbu]
target_trans: Apply a transformation to the whole grid before placing it.
shape: Respace the input of kcells into an array and fill as many positions
(first x then y).
align_x: Align all the instance on the x-coordinate.
align_y: Align all the instance on the y-coordinate.
rotation: Apply a rotation to each kcells instance before adding it to the grid.
mirror: Mirror the instances before placing them in the grid
"""
if isinstance(spacing, tuple):
spacing_x, spacing_y = spacing
else:
spacing_x = spacing
spacing_y = spacing
insts: list[list[Instance | None]]
kcell_array: Sequence[Sequence[KCell]]
if shape is None:
if isinstance(kcells[0], KCell):
kcell_array = [list(kcells)] # type:ignore[arg-type]
else:
kcell_array = kcells # type: ignore[assignment]
x0 = 0
y0 = 0
insts = [
[
target.create_inst(kcell, kdb.Trans(rotation, mirror, 0, 0))
for kcell in array
]
for array in kcell_array
]
bboxes = [
[None if inst is None else inst.bbox() for inst in array] for array in insts
]
w = max(
max(0 if bbox is None else bbox.width() + spacing_x for bbox in box_array)
for box_array in bboxes
)
h = max(
max(0 if bbox is None else bbox.height() + spacing_y for bbox in box_array)
for box_array in bboxes
)
for array, bbox_array in zip(insts, bboxes):
y0 += h - h // 2
for bbox, inst in zip(bbox_array, array):
x0 += w - w // 2
if bbox is not None and inst is not None:
match align_x:
case "xmin":
x = -bbox.left
case "xmax":
x = -bbox.right
case "center":
x = -bbox.center().x
case _:
x = 0
match align_y:
case "ymin":
y = -bbox.bottom
case "ymax":
y = -bbox.top
case "center":
y = -bbox.center().y
case _:
y = 0
at = kdb.Trans(x0 + x, y0 + y)
inst.transform(target_trans * at)
x0 += w // 2
y0 += h // 2
x0 = 0
return insts
else:
_kcells: list[KCell | None]
if isinstance(kcells[0], KCell):
_kcells = kcells # type:ignore[assignment]
else:
_kcells = [kcell for array in kcells for kcell in array] # type: ignore[union-attr]
if len(_kcells) > shape[0] * shape[1]:
raise ValueError(
f"Shape container size {shape[0] * shape[1]=!r} must be bigger "
f"than the number of kcells {len(_kcells)}"
)
x0 = 0
y0 = 0
_insts = [
None
if kcell is None
else target.create_inst(kcell, kdb.Trans(rotation, mirror, 0, 0))
for kcell in _kcells
]
insts = [[None] * shape[1]] * shape[0]
shape_bboxes = [None if inst is None else inst.bbox() for inst in _insts]
shape_bboxes_heights = [
0 if box is None else box.height() for box in shape_bboxes
]
shape_bboxes_widths = [
0 if box is None else box.width() for box in shape_bboxes
]
w = max(shape_bboxes_widths) + spacing_x
h = max(shape_bboxes_heights) + spacing_y
for i, (inst, bbox) in enumerate(zip(_insts, shape_bboxes)):
i_x = i % shape[1]
i_y = i // shape[1]
insts[i_y][i_x] = inst
if i_x == 0:
y0 += h - h // 2
x0 = 0
else:
x0 += w - w // 2
if bbox is not None and inst is not None:
match align_x:
case "xmin":
x = -bbox.left
case "xmax":
x = -bbox.right
case "center":
x = -bbox.center().x
case _:
x = 0
match align_y:
case "ymin":
y = -bbox.bottom
case "ymax":
y = -bbox.top
case "center":
y = -bbox.center().y
case _:
y = 0
at = kdb.Trans(x0 + x, y0 + y)
inst.transform(target_trans * at)
if i_x == shape[1] - 1:
y0 += h // 2
x0 = 0
else:
x0 += w // 2
return insts
def flexgrid_dbu(
target: KCell,
kcells: Sequence[KCell | None] | Sequence[Sequence[KCell | None]],
spacing: int | tuple[int, int],
target_trans: kdb.Trans = kdb.Trans(),
shape: tuple[int, int] | None = None,
align_x: Literal["origin", "xmin", "xmax", "center"] = "center",
align_y: Literal["origin", "ymin", "ymax", "center"] = "center",
rotation: Literal[0, 1, 2, 3] = 0,
mirror: bool = False,
) -> list[list[Instance | None]]:
"""Create a grid of instances.
A grid uses the bounding box of the biggest width per column and biggest height per
row of any bounding boxes inserted into the grid.
To this bounding box a spacing is applied in x and y.
```
spacing[0] or spacing
◄─►
┌──────────────────┐ ┌──┬─────┬──┐ ┌──────────┐ ┌──────────┐▲
│ │ │ │ │ │ │ │ │ ││
│ ┌────┐ │ │ │ │ │ │ │ │ ┌──────┼│
│ │ │ │ │ │ │ │ │ │ │ │ ││
│ │ │ │ │ │ big │ │ │ ┌───────┤ │ │ ││
│ │ ▼ │ │ │ │ comp│ │ │ │ │ │ │ ││
│ │ │ │ │ │ y │ │ │ │ │ │ │ ▼ ││
│ │ │ │ │ │ │ │ │ │ ▼ │ │ │ ││ y[1]
│ └────┘ │ │ │ ▼ │ │ │ │ │ │ │ ││
│ │ │ │ │ │ │ │ │ │ │ ││
│ │ │ │ │ │ │ │ │ │ └──────┼│
│ │ │ │ │ │ │ │ │ │ ││
│ │ │ │ │ │ │ └───────┤ │ ││
│ │ │ │ │ │ │ │ │ ││
▲└──────────────────┘ └──┴─────┴──┘ └──────────┘ └──────────┘▼
│spacing[1] or spacing
▼┌──────────────────┐ ┌───────────┐ ┌────┬─────┐ ┌───┬──────┐▲
├──────────────────┤ ├───────────┤ │ │ │ │ │ ││
│ │ │ │ │ │ │ │ │ ││
│ ▼ │ │ │ │ │ │ │ │ ││
│ big comp x │ │ │ │ │ │ │ │ ││
│ │ │ ▼ │ │ ▼ │ │ │ ▼ │ ││ y[0]
├──────────────────┤ │ │ │ │ │ │ │ ││
│ │ │ │ │ │ │ │ │ ││
│ │ │ │ │ │ │ │ │ ││
│ │ │ │ │ │ │ │ │ ││
└──────────────────┴─┴───────────┴─┴────┼─────┴─┴───┼──────┘►
►──────────────────► ►───────────► ►──────────► ►──────────►
x[0] x[1] x[2] x[3]
```
Args:
target: Target KCell.
kcells: Sequence or sequence of sequence of KCells to add to the grid
spacing: Value or tuple of value (different x/y) for spacing of the grid. [dbu]
target_trans: Apply a transformation to the whole grid before placing it.
shape: Respace the input of kcells into an array and fill as many positions
(first x then y).
align_x: Align all the instance on the x-coordinate.
align_y: Align all the instance on the y-coordinate.
rotation: Apply a rotation to each kcells instance before adding it to the grid.
mirror: Mirror the instances before placing them in the grid
"""
if isinstance(spacing, tuple):
spacing_x, spacing_y = spacing
else:
spacing_x = spacing
spacing_y = spacing
insts: list[list[Instance | None]]
kcell_array: Sequence[Sequence[KCell]]
if shape is None:
if isinstance(kcells[0], KCell):
kcell_array = cast(Sequence[list[KCell]], [list(kcells)])
else:
kcell_array = cast(Sequence[Sequence[KCell]], kcells)
x0 = 0
y0 = 0
insts = [
[
None
if kcell is None
else target.create_inst(kcell, kdb.Trans(rotation, mirror, 0, 0))
for kcell in array
]
for array in kcell_array
]
bboxes = [
[None if inst is None else inst.bbox() for inst in array] for array in insts
]
xmin: dict[int, int] = {}
ymin: dict[int, int] = {}
ymax: dict[int, int] = {}
xmax: dict[int, int] = {}
for i_y, (array, box_array) in enumerate(zip(insts, bboxes)):
for i_x, (inst, bbox) in enumerate(zip(array, box_array)):
if inst is not None and bbox is not None:
if inst is not None and bbox is not None:
match align_x:
case "xmin":
x = -bbox.left
case "xmax":
x = -bbox.right
case "center":
x = -bbox.center().x
case _:
x = 0
match align_y:
case "ymin":
y = -bbox.bottom
case "ymax":
y = -bbox.top
case "center":
y = -bbox.center().y
case _:
y = 0
at = kdb.Trans(x, y)
inst.trans = at * inst.trans
bbox = inst.bbox()
xmin[i_x] = min(
xmin.get(i_x, None) or bbox.left, bbox.left - spacing_x
)
xmax[i_x] = max(xmax.get(i_x, None) or bbox.right, bbox.right)
ymin[i_y] = min(
ymin.get(i_y, None) or bbox.bottom, bbox.bottom - spacing_y
)
ymax[i_y] = max(ymax.get(i_y, None) or bbox.top, bbox.top)
for i_y, (array, bbox_array) in enumerate(zip(insts, bboxes)):
y0 -= ymin.get(i_y, 0)
for i_x, (bbox, inst) in enumerate(zip(bbox_array, array)):
x0 -= xmin.get(i_x, 0)
if inst is not None and bbox is not None:
at = kdb.Trans(x0, y0)
inst.transform(target_trans * at)
x0 += xmax.get(i_x, 0)
y0 += ymax.get(i_y, 0)
x0 = 0
return insts
else:
_kcells: list[KCell | None]
if isinstance(kcells[0], KCell):
_kcells = kcells # type:ignore[assignment]
else:
_kcells = [kcell for array in kcells for kcell in array] # type: ignore[union-attr]
if len(_kcells) > shape[0] * shape[1]:
raise ValueError(
f"Shape container size {shape[0] * shape[1]=} must be bigger "
f"than the number of kcells {len(_kcells)}"
)
x0 = 0
y0 = 0
_insts = [
None
if kcell is None
else target.create_inst(kcell, kdb.Trans(rotation, mirror, 0, 0))
for kcell in _kcells
]
xmin = {}
ymin = {}
ymax = {}
xmax = {}
for i, inst in enumerate(_insts):
i_x = i % shape[1]
i_y = i // shape[1]
if inst is not None:
bbox = inst.bbox()
match align_x:
case "xmin":
x = -bbox.left
case "xmax":
x = -bbox.right
case "center":
x = -bbox.center().x
case _:
x = 0
match align_y:
case "ymin":
y = -bbox.bottom
case "ymax":
y = -bbox.top
case "center":
y = -bbox.center().y
case _:
y = 0
at = kdb.Trans(x, y)
inst.trans = at * inst.trans
bbox = inst.bbox()
xmin[i_x] = min(xmin.get(i_x, None) or bbox.left, bbox.left - spacing_x)
xmax[i_x] = max(xmax.get(i_x, None) or bbox.right, bbox.right)
ymin[i_y] = min(
ymin.get(i_y, None) or bbox.bottom, bbox.bottom - spacing_y
)
ymax[i_y] = max(ymax.get(i_y, None) or bbox.top, bbox.top)
insts = [[None] * shape[1]] * shape[0]
for i, inst in enumerate(_insts):
i_x = i % shape[1]
i_y = i // shape[1]
if i_x == 0:
y0 -= ymin.get(i_y, 0)
x0 = 0
else:
x0 -= xmin.get(i_x, 0)
if inst is not None:
at = kdb.Trans(x0, y0)
inst.transform(target_trans * at)
insts[i_y][i_x] = inst
if i_x == shape[1] - 1:
y0 += ymax.get(i_y, 0)
x0 = 0
else:
x0 += xmax.get(i_x, 0)
return insts
def grid(
target: KCell,
kcells: Sequence[KCell | None] | Sequence[Sequence[KCell | None]],
spacing: int | tuple[float, float],
target_trans: kdb.DCplxTrans = kdb.DCplxTrans(),
shape: tuple[int, int] | None = None,
align_x: Literal["origin", "xmin", "xmax", "center"] = "center",
align_y: Literal["origin", "ymin", "ymax", "center"] = "center",
rotation: Literal[0, 1, 2, 3] = 0,
mirror: bool = False,
) -> list[list[Instance | None]]:
"""Create a grid of instances.
A grid uses the bounding box of the biggest width and biggest height of any bounding
boxes inserted into the grid.
to this bounding box a spacing is applied in x and y.
```
spacing[0] or spacing
◄─►
┌──────────────────┐ ┌────┬─────┬─────┐ ┌────────────────┐ ┌──────────────────┐ ▲
│ │ │ │ │ │ │ │ │ │ │
│ ┌────┐ │ │ │ │ │ │ │ │ ┌──────┐ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ big │ │ │ ┌───────┐ │ │ │ │ │ │
│ │ │ │ │ │ comp│ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ y │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ max bbox y
│ └────┘ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ └──────┘ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ └───────┘ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │
▲└──────────────────┘ └────┴─────┴─────┘ └────────────────┘ └──────────────────┘ ▼
│spacing[1] or spacing
▼┌──────────────────┐ ┌────────────────┐ ┌────────────────┐ ┌──────────────────┐
│ │ │ │ │ │ │ │
│ │ │ │ │ ┌────┐ │ │ ┌───┐ │
├──────────────────┤ │ ┌───────────┐ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │
│ big comp x │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │
├──────────────────┤ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ └───────────┘ │ │ └────┘ │ │ └───┘ │
│ │ │ │ │ │ │ │
└──────────────────┘ └────────────────┘ └────────────────┘ └──────────────────┘
◄──────────────────►
max bbox x
```
Args:
target: Target KCell.
kcells: Sequence or sequence of sequence of KCells to add to the grid
spacing: Value or tuple of value (different x/y) for spacing of the grid. [um]
target_trans: Apply a transformation to the whole grid before placing it.
shape: Respace the input of kcells into an array and fill as many positions
(first x then y).
align_x: Align all the instance on the x-coordinate.
align_y: Align all the instance on the y-coordinate.
rotation: Apply a rotation to each kcells instance before adding it to the grid.
mirror: Mirror the instances before placing them in the grid
"""
if isinstance(spacing, tuple):
spacing_x, spacing_y = spacing
else:
spacing_x = spacing
spacing_y = spacing
insts: list[list[Instance | None]]
kcell_array: Sequence[Sequence[KCell]]
if shape is None:
if isinstance(kcells[0], KCell):
kcell_array = [list(kcells)] # type:ignore[arg-type]
else:
kcell_array = kcells # type: ignore[assignment]
x0 = 0
y0 = 0
insts = [
[
target.create_inst(kcell, kdb.ICplxTrans(1, rotation, mirror, 0, 0))
for kcell in array
]
for array in kcell_array
]
bboxes = [
[None if inst is None else inst.dbbox() for inst in array]
for array in insts
]
w = max(
max(0 if bbox is None else bbox.width() + spacing_x for bbox in box_array)
for box_array in bboxes
)
h = max(
max(0 if bbox is None else bbox.height() + spacing_y for bbox in box_array)
for box_array in bboxes
)
for array, bbox_array in zip(insts, bboxes):
y0 += h - h // 2
for bbox, inst in zip(bbox_array, array):
x0 += w - w // 2
if bbox is not None and inst is not None:
match align_x:
case "xmin":
x = -bbox.left
case "xmax":
x = -bbox.right
case "center":
x = -bbox.center().x
case _:
x = 0
match align_y:
case "ymin":
y = -bbox.bottom
case "ymax":
y = -bbox.top
case "center":
y = -bbox.center().y
case _:
y = 0
at = kdb.DCplxTrans(x0 + x, y0 + y)
inst.transform(target_trans * at)
x0 += w // 2
y0 += h // 2
x0 = 0
return insts
else:
_kcells: list[KCell | None]
if isinstance(kcells[0], KCell):
_kcells = kcells # type:ignore[assignment]
else:
_kcells = [kcell for array in kcells for kcell in array] # type: ignore[union-attr]
if len(_kcells) > shape[0] * shape[1]:
raise ValueError(
f"Shape container size {shape[0] * shape[1]=!r} must be bigger "
f"than the number of kcells {len(_kcells)}"
)
x0 = 0
y0 = 0
_insts = [
None
if kcell is None
else target.create_inst(kcell, kdb.ICplxTrans(1, rotation, mirror, 0, 0))
for kcell in _kcells
]
insts = [[None] * shape[1]] * shape[0]
shape_bboxes = [None if inst is None else inst.dbbox() for inst in _insts]
shape_bboxes_heights = [
0 if box is None else box.height() for box in shape_bboxes
]
shape_bboxes_widths = [
0 if box is None else box.width() for box in shape_bboxes
]
w = max(shape_bboxes_widths) + spacing_x
h = max(shape_bboxes_heights) + spacing_y
for i, (inst, bbox) in enumerate(zip(_insts, shape_bboxes)):
i_x = i % shape[1]
i_y = i // shape[1]
insts[i_y][i_x] = inst
if i_x == 0:
y0 += h - h // 2
x0 = 0
else:
x0 += w - w // 2
if bbox is not None and inst is not None:
match align_x:
case "xmin":
x = -bbox.left
case "xmax":
x = -bbox.right
case "center":
x = -bbox.center().x
case _:
x = 0
match align_y:
case "ymin":
y = -bbox.bottom
case "ymax":
y = -bbox.top
case "center":
y = -bbox.center().y
case _:
y = 0
at = kdb.DCplxTrans(x0 + x, y0 + y)
inst.transform(target_trans * at)
if i_x == shape[1] - 1:
y0 += h // 2
x0 = 0
else:
x0 += w // 2
return insts
def flexgrid(
target: KCell,
kcells: Sequence[KCell | None] | Sequence[Sequence[KCell | None]],
spacing: int | tuple[int, int],
target_trans: kdb.DCplxTrans = kdb.DCplxTrans(),
shape: tuple[int, int] | None = None,
align_x: Literal["origin", "xmin", "xmax", "center"] = "center",
align_y: Literal["origin", "ymin", "ymax", "center"] = "center",
rotation: Literal[0, 1, 2, 3] = 0,
mirror: bool = False,
) -> list[list[Instance | None]]:
"""Create a grid of instances.
A grid uses the bounding box of the biggest width per column and biggest height per
row of any bounding boxes inserted into the grid.
To this bounding box a spacing is applied in x and y.
```
spacing[0] or spacing
◄─►
┌──────────────────┐ ┌──┬─────┬──┐ ┌──────────┐ ┌──────────┐▲
│ │ │ │ │ │ │ │ │ ││
│ ┌────┐ │ │ │ │ │ │ │ │ ┌──────┼│
│ │ │ │ │ │ │ │ │ │ │ │ ││
│ │ │ │ │ │ big │ │ │ ┌───────┤ │ │ ││
│ │ ▼ │ │ │ │ comp│ │ │ │ │ │ │ ││
│ │ │ │ │ │ y │ │ │ │ │ │ │ ▼ ││
│ │ │ │ │ │ │ │ │ │ ▼ │ │ │ ││ y[1]
│ └────┘ │ │ │ ▼ │ │ │ │ │ │ │ ││
│ │ │ │ │ │ │ │ │ │ │ ││
│ │ │ │ │ │ │ │ │ │ └──────┼│
│ │ │ │ │ │ │ │ │ │ ││
│ │ │ │ │ │ │ └───────┤ │ ││
│ │ │ │ │ │ │ │ │ ││
▲└──────────────────┘ └──┴─────┴──┘ └──────────┘ └──────────┘▼
│spacing[1] or spacing
▼┌──────────────────┐ ┌───────────┐ ┌────┬─────┐ ┌───┬──────┐▲
├──────────────────┤ ├───────────┤ │ │ │ │ │ ││
│ │ │ │ │ │ │ │ │ ││
│ ▼ │ │ │ │ │ │ │ │ ││
│ big comp x │ │ │ │ │ │ │ │ ││
│ │ │ ▼ │ │ ▼ │ │ │ ▼ │ ││ y[0]
├──────────────────┤ │ │ │ │ │ │ │ ││
│ │ │ │ │ │ │ │ │ ││
│ │ │ │ │ │ │ │ │ ││
│ │ │ │ │ │ │ │ │ ││
└──────────────────┴─┴───────────┴─┴────┼─────┴─┴───┼──────┘►
►──────────────────► ►───────────► ►──────────► ►──────────►
x[0] x[1] x[2] x[3]
```
Args:
target: Target KCell.
kcells: Sequence or sequence of sequence of KCells to add to the grid
spacing: Value or tuple of value (different x/y) for spacing of the grid.
target_trans: Apply a transformation to the whole grid before placing it.
shape: Respace the input of kcells into an array and fill as many positions
(first x then y).
align_x: Align all the instance on the x-coordinate.
align_y: Align all the instance on the y-coordinate.
rotation: Apply a rotation to each kcells instance before adding it to the grid.
mirror: Mirror the instances before placing them in the grid
"""
if isinstance(spacing, tuple):
spacing_x, spacing_y = spacing
else:
spacing_x = spacing
spacing_y = spacing
insts: list[list[Instance | None]]
kcell_array: Sequence[Sequence[KCell]]
if shape is None:
if isinstance(kcells[0], KCell):
kcell_array = cast(Sequence[list[KCell]], [list(kcells)])
else:
kcell_array = cast(Sequence[Sequence[KCell]], kcells)
x0 = 0
y0 = 0
insts = [
[
None
if kcell is None
else target.create_inst(
kcell, kdb.ICplxTrans(1, rotation, mirror, 0, 0)
)
for kcell in array
]
for array in kcell_array
]
bboxes = [
[None if inst is None else inst.dbbox() for inst in array]
for array in insts
]
xmin: dict[int, int] = {}
ymin: dict[int, int] = {}
ymax: dict[int, int] = {}
xmax: dict[int, int] = {}
for i_y, (array, box_array) in enumerate(zip(insts, bboxes)):
for i_x, (inst, bbox) in enumerate(zip(array, box_array)):
if inst is not None and bbox is not None:
if inst is not None and bbox is not None:
match align_x:
case "xmin":
x = -bbox.left
case "xmax":
x = -bbox.right
case "center":
x = -bbox.center().x
case _:
x = 0
match align_y:
case "ymin":
y = -bbox.bottom
case "ymax":
y = -bbox.top
case "center":
y = -bbox.center().y
case _:
y = 0
at = kdb.DCplxTrans(x, y)
inst.dcplx_trans = at * inst.dcplx_trans
bbox = inst.dbbox()
xmin[i_x] = min(
xmin.get(i_x, None) or bbox.left, bbox.left - spacing_x
)
xmax[i_x] = max(xmax.get(i_x, None) or bbox.right, bbox.right)
ymin[i_y] = min(
ymin.get(i_y, None) or bbox.bottom, bbox.bottom - spacing_y
)
ymax[i_y] = max(ymax.get(i_y, None) or bbox.top, bbox.top)
for i_y, (array, bbox_array) in enumerate(zip(insts, bboxes)):
y0 -= ymin.get(i_y, 0)
for i_x, (bbox, inst) in enumerate(zip(bbox_array, array)):
x0 -= xmin.get(i_x, 0)
if inst is not None and bbox is not None:
at = kdb.DCplxTrans(x0, y0)
inst.transform(target_trans * at)
x0 += xmax.get(i_x, 0)
y0 += ymax.get(i_y, 0)
x0 = 0
return insts
else:
_kcells: list[KCell | None]
if isinstance(kcells[0], KCell):
_kcells = kcells # type:ignore[assignment]
else:
_kcells = [kcell for array in kcells for kcell in array] # type: ignore[union-attr]
if len(_kcells) > shape[0] * shape[1]:
raise ValueError(
f"Shape container size {shape[0] * shape[1]=} must be bigger "
f"than the number of kcells {len(_kcells)}"
)
x0 = 0
y0 = 0
_insts = [
None
if kcell is None
else target.create_inst(kcell, kdb.ICplxTrans(1, rotation, mirror, 0, 0))
for kcell in _kcells
]
xmin = {}
ymin = {}
ymax = {}
xmax = {}
for i, inst in enumerate(_insts):
i_x = i % shape[1]
i_y = i // shape[1]
if inst is not None:
bbox = inst.dbbox()
match align_x:
case "xmin":
x = -bbox.left
case "xmax":
x = -bbox.right
case "center":
x = -bbox.center().x
case _:
x = 0
match align_y:
case "ymin":
y = -bbox.bottom
case "ymax":
y = -bbox.top
case "center":
y = -bbox.center().y
case _:
y = 0
at = kdb.DCplxTrans(x, y)
inst.dcplx_trans = at * inst.dcplx_trans
bbox = inst.dbbox()
xmin[i_x] = min(xmin.get(i_x, None) or bbox.left, bbox.left - spacing_x)
xmax[i_x] = max(xmax.get(i_x, None) or bbox.right, bbox.right)
ymin[i_y] = min(
ymin.get(i_y, None) or bbox.bottom, bbox.bottom - spacing_y
)
ymax[i_y] = max(ymax.get(i_y, None) or bbox.top, bbox.top)
insts = [[None] * shape[1]] * shape[0]
for i, inst in enumerate(_insts):
i_x = i % shape[1]
i_y = i // shape[1]
if i_x == 0:
y0 -= ymin.get(i_y, 0)
x0 = 0
else:
x0 -= xmin.get(i_x, 0)
if inst is not None:
at = kdb.DCplxTrans(x0, y0)
inst.transform(target_trans * at)
insts[i_y][i_x] = inst
if i_x == shape[1] - 1:
y0 += ymax.get(i_y, 0)
x0 = 0
else:
x0 += xmax.get(i_x, 0)
return insts
|
kfactory/src/kfactory/grid.py/0
|
{
"file_path": "kfactory/src/kfactory/grid.py",
"repo_id": "kfactory",
"token_count": 22823
}
| 112
|
"""Utilities to fix DRC violations.
:py:func:~`fix_spacing_tiled` uses :py:func:~`kdb.Region.space_check` to detect
minimum space violations and then applies a fix.
"""
from typing import overload
from .. import KCell, LayerEnum, kdb
from ..conf import config, logger
__all__ = [
"fix_spacing_tiled",
"fix_spacing_sizing_tiled",
"fix_spacing_minkowski_tiled",
]
@overload
def fix_spacing_tiled(
c: KCell,
min_space: int,
layer: LayerEnum | int,
metrics: kdb.Metrics = kdb.Metrics.Euclidian,
ignore_angle: float = 80,
size_space_check: int = 5,
n_threads: int = 4,
tile_size: tuple[float, float] | None = None,
overlap: float = 3,
smooth_factor: float = 0.05,
) -> kdb.Region: ...
@overload
def fix_spacing_tiled(
c: KCell,
min_space: int,
layer: LayerEnum | int,
metrics: kdb.Metrics = kdb.Metrics.Euclidian,
ignore_angle: float = 80,
size_space_check: int = 5,
n_threads: int = 4,
tile_size: tuple[float, float] | None = None,
overlap: float = 3,
*,
smooth_absolute: int,
) -> kdb.Region: ...
def fix_spacing_tiled(
c: KCell,
min_space: int,
layer: LayerEnum | int,
metrics: kdb.Metrics = kdb.Metrics.Euclidian,
ignore_angle: float = 80,
size_space_check: int = 5,
n_threads: int | None = None,
tile_size: tuple[float, float] | None = None,
overlap: float = 3,
smooth_factor: float = 0.05,
smooth_absolute: int | None = None,
smooth_keep_hv: bool = True,
) -> kdb.Region:
"""Fix minimum space violations.
Fix min space issues by running a drc check on the input region and merging
it with the affcted polygons.
Args:
c: Input cell
min_space: Minimum space rule [dbu]
layer: Input layer index
metrics: The metrics to use to determine the violation edges
ignore_angle: ignore angles greater or equal to this angle
size_space_check: Sizing in dbu of the offending edges towards the polygons
n_threads: on how many threads to run the check simultaneously
tile_size: tuple determining the size of each sub tile (in um), should be big
compared to the violation size
overlap: how many times bigger to make the tile border in relation to the
violation size. Smaller than 1 can lead to errors
smooth_factor: how big to smooth the resulting region in relation to the
violation. 1 == the violation size. Set to 0 to disable
smooth_absolute: If set will overwrite smooth with an an absolute value, not
relative to the violation size. If set, this will disable smooth_factor.
[dbu]
smooth_keep_hv: Keep horizontal and vertical vertices when smoothing.
Returns:
fix: Region containing the fixes for the violations
"""
if tile_size is None:
min(25 * min_space, 250)
tile_size = (30 * min_space * c.kcl.dbu, 30 * min_space * c.kcl.dbu)
tp = kdb.TilingProcessor()
tp.frame = c.bbox(layer).to_dtype(c.kcl.dbu) # type: ignore[misc]
tp.dbu = c.kcl.dbu
tp.tile_size(*tile_size) # tile size in um
tp.tile_border(min_space * overlap * tp.dbu, min_space * overlap * tp.dbu)
tp.input("reg", c.kcl.layout, c.cell_index(), layer)
tp.threads = n_threads or config.n_threads
fix_reg = RegionOperator()
tp.output("fix_reg", fix_reg)
if smooth_factor != 0 or smooth_absolute:
keep = "true" if smooth_keep_hv else "false"
smooth = (
min(int(smooth_factor * min_space), 1)
if not smooth_absolute
else smooth_absolute
)
queue_str = (
f"var sc = reg.space_check({min_space},"
f" false, Metrics.{metrics.to_s()},"
f" {ignore_angle}); "
"var edges = sc.edges(); edges.merge(); "
f"var r_int = (edges.extended(0, 0, 0, {size_space_check}, true)"
" + sc.polygons()); r_int.merge();"
" r_int.insert(reg.interacting(sc.polygons())); "
f"r_int.merge(); r_int.smooth({smooth}, {keep}); "
f"_output(fix_reg, r_int)"
)
else:
queue_str = (
f"var sc = reg.space_check({min_space},"
f" false, Metrics.{metrics.to_s()},"
f" {ignore_angle});"
"var edges = sc.edges(); edges.merge();"
f"var r_int = (edges.extended(0, 0, 0, {size_space_check}, true)"
" + sc.polygons()); r_int.merge();"
" r_int.insert(reg.interacting(sc.polygons()));"
"r_int.merge(); _output(fix_reg, r_int)"
)
tp.queue(queue_str)
c.kcl.start_changes()
tp.execute("Min Space Fix")
c.kcl.end_changes()
return fix_reg.region
def fix_spacing_sizing_tiled(
c: KCell,
min_space: int,
layer: LayerEnum,
n_threads: int | None = None,
tile_size: tuple[float, float] | None = None,
overlap: int = 2,
) -> kdb.Region:
"""Fix min space issues by using a dilation & erosion.
Args:
c: Input cell
min_space: Minimum space rule [dbu]
layer: Input layer index
n_threads: on how many threads to run the check simultaneously
tile_size: tuple determining the size of each sub tile (in um), should be big
compared to the violation size
overlap: how many times bigger to make the tile border in relation to the
violation size. Smaller than 1 can lead to errors
Returns:
kdb.Region: Region containing the fixes for the violations
"""
tp = kdb.TilingProcessor()
if tile_size is None:
size = min_space * 20 * c.kcl.dbu
tile_size = (size, size)
tp.frame = c.bbox(layer).to_dtype(c.kcl.dbu) # type: ignore[misc]
tp.dbu = c.kcl.dbu
tp.tile_size(*tile_size) # tile size in um
tp.tile_border(min_space * overlap * tp.dbu, min_space * overlap * tp.dbu)
tp.input("reg", c.kcl.layout, c.cell_index(), layer)
tp.threads = n_threads or config.n_threads
fix_reg = kdb.Region()
tp.output("fix_reg", fix_reg)
queue_str = (
"var tile_reg=reg & (_tile & _frame);"
+ f"reg = tile_reg.sized({min_space}).sized({-min_space});"
+ "_output(fix_reg, reg)"
)
tp.queue(queue_str)
c.kcl.start_changes()
tp.execute("Min Space Fix")
c.kcl.end_changes()
return fix_reg
def fix_spacing_minkowski_tiled(
c: KCell,
min_space: int,
ref: LayerEnum | kdb.Region,
n_threads: int | None = None,
tile_size: tuple[float, float] | None = None,
overlap: int = 1,
smooth: int | None = None,
) -> kdb.Region:
"""Fix min space issues by using a dilation & erosion with a box.
Args:
c: Input cell
min_space: Minimum space rule [dbu]
ref: Input layer index or region
n_threads: on how many threads to run the check simultaneously
tile_size: tuple determining the size of each sub tile (in um), should be big
compared to the violation size
overlap: how many times bigger to make the tile border in relation to the
violation size. Smaller than 1 can lead to errors
smooth: Apply smoothening (simplifying) at the end if > 0
Returns:
kdb.Region: Region containing the fixes for the violations
"""
tp = kdb.TilingProcessor()
tp.frame = c.dbbox() # type: ignore[misc]
tp.dbu = c.kcl.dbu
tp.threads = n_threads or config.n_threads
min_tile_size_rec = 10 * min_space * tp.dbu
if tile_size is None:
tile_size = (min_tile_size_rec * 2, min_tile_size_rec * 2)
tp.tile_border(min_space * overlap * tp.dbu, min_space * overlap * tp.dbu)
tp.tile_size(*tile_size)
if isinstance(ref, int):
tp.input("main_layer", c.kcl.layout, c.cell_index(), ref)
else:
tp.input("main_layer", ref)
operator = RegionOperator()
tp.output("target", operator)
if smooth is None:
queue_str = (
f"var tile_reg = (_tile & _frame).sized({min_space});"
f"var shape = Box.new({min_space},{min_space});"
"var reg = main_layer.minkowski_sum(shape); reg.merge();"
"reg = tile_reg - (tile_reg - reg).minkowski_sum(shape);"
"_output(target, reg & _tile, true);"
)
else:
queue_str = (
f"var tile_reg = (_tile & _frame).sized({min_space});"
f"var shape = Box.new({min_space},{min_space});"
"var reg = main_layer.minkowski_sum(shape); reg.merge();"
"reg = tile_reg - (tile_reg - reg).minkowski_sum(shape);"
f"reg.smooth({smooth});"
"_output(target, reg & _tile, true);"
)
tp.queue(queue_str)
logger.debug("String queued for {}: {}", c.name, queue_str)
c.kcl.start_changes()
logger.info("Starting minkowski on {}", c.name)
tp.execute(f"Minkowski {c.name}")
c.kcl.end_changes()
return operator.region
def fix_width_minkowski_tiled(
c: KCell,
min_width: int,
ref: LayerEnum | kdb.Region,
n_threads: int | None = None,
tile_size: tuple[float, float] | None = None,
overlap: int = 1,
smooth: int | None = None,
) -> kdb.Region:
"""Fix min space issues by using a dilation & erosion with a box.
Args:
c: Input cell
min_width: Minimum width rule [dbu]
ref: Input layer index or region
n_threads: on how many threads to run the check simultaneously
tile_size: tuple determining the size of each sub tile (in um), should be big
compared to the violation size
overlap: how many times bigger to make the tile border in relation to the
violation size. Smaller than 1 can lead to errors
smooth: Apply smoothening (simplifying) at the end if > 0
Returns:
kdb.Region: Region containing the fixes for the violations
"""
tp = kdb.TilingProcessor()
tp.frame = c.dbbox() # type: ignore[misc]
tp.dbu = c.kcl.dbu
tp.threads = n_threads or config.n_threads
min_tile_size_rec = 10 * min_width * tp.dbu
if tile_size is None:
tile_size = (min_tile_size_rec * 2, min_tile_size_rec * 2)
tp.tile_border(min_width * overlap * tp.dbu, min_width * overlap * tp.dbu)
tp.tile_size(*tile_size)
if isinstance(ref, int):
tp.input("main_layer", c.kcl.layout, c.cell_index(), ref)
else:
tp.input("main_layer", ref)
operator = RegionOperator()
tp.output("target", operator)
if smooth is None:
queue_str = (
f"var tile_reg = (_tile & _frame).sized({min_width});"
f"var shape = Box.new({min_width},{min_width});"
"var reg = tile_reg - (tile_reg - main_layer).minkowski_sum(shape);"
"reg = reg.minkowski_sum(shape); reg.merge();"
"_output(target, reg & _tile, true);"
)
else:
queue_str = (
f"var tile_reg = (_tile & _frame).sized({min_width});"
f"var shape = Box.new({min_width},{min_width});"
"var reg = tile_reg - (tile_reg - main_layer).minkowski_sum(shape);"
"reg = reg.minkowski_sum(shape); reg.merge();"
f"reg.smooth({smooth});"
"_output(target, reg & _tile, true);"
)
tp.queue(queue_str)
logger.debug("String queued for {}: {}", c.name, queue_str)
c.kcl.start_changes()
logger.info("Starting minkowski on {}", c.name)
tp.execute(f"Minkowski {c.name}")
c.kcl.end_changes()
return operator.region
def fix_width_and_spacing_minkowski_tiled(
c: KCell,
min_space: int,
min_width: int,
ref: LayerEnum | kdb.Region,
n_threads: int | None = None,
tile_size: tuple[float, float] | None = None,
overlap: int = 1,
smooth: int | None = None,
) -> kdb.Region:
"""Fix min space and width issues by using a dilation & erosion with a box.
The algorithm will dilate by min_space, erode by min_width + min_space, and
finally dilate by min_width
Args:
c: Input cell
min_space: Minimum space rule [dbu]
min_width: Minimum width rule [dbu]
ref: Input layer index or region
n_threads: on how many threads to run the check simultaneously
tile_size: tuple determining the size of each sub tile (in um), should be big
compared to the violation size
overlap: how many times bigger to make the tile border in relation to the
violation size. Smaller than 1 can lead to errors (overlap*min_space)
smooth: Apply smoothening (simplifying) at the end if > 0
Returns:
kdb.Region: Region containing the fixes for the violations
"""
tp = kdb.TilingProcessor()
tp.frame = c.dbbox() # type: ignore[misc]
tp.dbu = c.kcl.dbu
tp.threads = n_threads or config.n_threads
min_tile_size_rec = 10 * min_space * tp.dbu
if tile_size is None:
tile_size = (min_tile_size_rec * 2, min_tile_size_rec * 2)
border = min_space * tp.dbu * overlap
tp.tile_border(border, border)
tp.tile_size(*tile_size)
if isinstance(ref, int):
tp.input("main_layer", c.kcl.layout, c.cell_index(), ref)
else:
tp.input("main_layer", ref)
shrink = min_space + min_width
operator = RegionOperator()
tp.output("target", operator)
if smooth is None:
queue_str = (
f"var tile_reg = (_tile & _frame).sized({min_space});"
f"var space_shape = Box.new({min_space},{min_space});"
f"var shrink_shape = Box.new({shrink},{shrink});"
f"var width_shape = Box.new({min_width},{min_width});"
"var reg = main_layer.minkowski_sum(space_shape); reg.merge();"
"reg = tile_reg - (tile_reg - reg).minkowski_sum(shrink_shape);"
"reg = reg.minkowski_sum(width_shape);"
"_output(target, reg & _tile, true);"
)
else:
queue_str = (
f"var tile_reg = (_tile & _frame).sized({min_space});"
f"var space_shape = Box.new({min_space},{min_space});"
f"var shrink_shape = Box.new({shrink},{shrink});"
f"var width_shape = Box.new({min_width},{min_width});"
"var reg = main_layer.minkowski_sum(space_shape); reg.merge();"
"reg = tile_reg - (tile_reg - reg).minkowski_sum(shrink_shape);"
"reg = reg.minkowski_sum(width_shape);"
f"reg.smooth({smooth});"
"_output(target, reg & _tile, true);"
)
tp.queue(queue_str)
logger.debug("String queued for {}: {}", c.name, queue_str)
c.kcl.start_changes()
logger.info("Starting minkowski on {}", c.name)
tp.execute(f"Minkowski {c.name}")
c.kcl.end_changes()
return operator.region
class RegionOperator(kdb.TileOutputReceiver):
"""Region collector. Just getst the tile and inserts it into the target cell."""
def __init__(self) -> None:
"""Initialization."""
self.region = kdb.Region()
def put(
self,
ix: int,
iy: int,
tile: kdb.Box,
region: kdb.Region,
dbu: float,
clip: bool,
) -> None:
"""Tiling Processor output call.
Args:
ix: x-axis index of tile.
iy: y_axis index of tile.
tile: The bounding box of the tile.
region: The target object of the :py:class:~`klayout.db.TilingProcessor`
dbu: dbu used by the processor.
clip: Whether the target was clipped to the tile or not.
"""
self.region.insert(region)
|
kfactory/src/kfactory/utils/violations.py/0
|
{
"file_path": "kfactory/src/kfactory/utils/violations.py",
"repo_id": "kfactory",
"token_count": 6901
}
| 113
|
import kfactory as kf
import klayout.db as kdb
def test_instance_xsize(LAYER: kf.LayerEnum) -> None:
c = kf.KCell()
ref = c << kf.cells.straight.straight(width=0.5, length=1, layer=LAYER.WG)
assert ref.xsize
def test_instance_center(LAYER: kf.LayerEnum) -> None:
c = kf.KCell()
ref1 = c << kf.cells.straight.straight(width=0.5, length=1, layer=LAYER.WG)
ref2 = c << kf.cells.straight.straight(width=0.5, length=1, layer=LAYER.WG)
ref1.center = ref2.center
ref2.center = ref1.center + kdb.Point(0, 1000).to_v()
ref2.d.move((0, 10))
def test_instance_d_move(LAYER: kf.LayerEnum) -> None:
c = kf.KCell()
ref = c << kf.cells.straight.straight(width=0.5, length=1, layer=LAYER.WG)
ref.d.movex(10)
ref.d.movex(10.0)
ref.d.movey(10)
ref.d.movey(10.0)
ref.d.movex(10).movey(10)
ref.d.rotate(45).movey(10)
ref.d.xmin = 0
ref.d.xmax = 0
ref.d.ymin = 0
ref.d.ymax = 0
ref.d.mirror_y(0)
ref.d.mirror_x(0)
def test_mirror(LAYER: kf.LayerEnum) -> None:
"""Test arbitrary mirror."""
c = kf.KCell()
b = kf.cells.euler.bend_euler(width=1, radius=10, layer=LAYER.WG)
b1 = c << b
b2 = c << b
disp = kdb.Trans(5000, 5000)
# mp1 = kf.kdb.Point(-10000, 10000)
mp1 = kf.kdb.Point(50000, 25000)
mp2 = -mp1
b2.mirror(disp * mp1, disp * mp2)
c.shapes(LAYER.WG).insert(kf.kdb.Edge(mp1, mp2).transformed(disp))
c.show()
def test_dmirror(LAYER: kf.LayerEnum) -> None:
"""Test arbitrary mirror."""
c = kf.KCell()
b = kf.cells.euler.bend_euler(width=1, radius=10, layer=LAYER.WG)
b1 = c << b
b2 = c << b
disp = kdb.Trans(5000, 5000).to_dtype(c.kcl.dbu)
# mp1 = kf.kdb.Point(-10000, 10000)
mp1 = kf.kdb.Point(50000, 25000).to_dtype(c.kcl.dbu)
mp2 = -mp1
b2.d.mirror(disp * mp1, disp * mp2)
c.shapes(LAYER.WG).insert(kf.kdb.DEdge(mp1, mp2).transformed(disp))
c.show()
|
kfactory/tests/test_instance.py/0
|
{
"file_path": "kfactory/tests/test_instance.py",
"repo_id": "kfactory",
"token_count": 1004
}
| 114
|
# Changelog
## 0.0.3
- rename waveguide to straight
- rename theta to angle in bends
- fix docs
## 0.0.1
- first release
|
kgeneric/CHANGELOG.md/0
|
{
"file_path": "kgeneric/CHANGELOG.md",
"repo_id": "kgeneric",
"token_count": 47
}
| 115
|
"""Bezier curve based bends and functions."""
from collections.abc import Sequence
import numpy as np
import numpy.typing as nty
from kfactory import KCell, LayerEnum, cell, kdb
from kfactory.enclosure import LayerEnclosure, extrude_path
from scipy.special import binom # type: ignore[import]
__all__ = ["bend_s"]
def bezier_curve(
t: nty.NDArray[np.float64],
control_points: Sequence[tuple[np.float64 | float, np.float64 | float]],
) -> list[kdb.DPoint]:
"""Calculates the backbone of a bezier bend."""
xs = np.zeros(t.shape, dtype=np.float64)
ys = np.zeros(t.shape, dtype=np.float64)
n = len(control_points) - 1
for k in range(n + 1):
ank = binom(n, k) * (1 - t) ** (n - k) * t**k
xs += ank * control_points[k][0]
ys += ank * control_points[k][1]
return [kdb.DPoint(float(x), float(y)) for x, y in zip(xs, ys)]
@cell
def bend_s(
width: float,
height: float,
length: float,
layer: int | LayerEnum,
nb_points: int = 99,
t_start: float = 0,
t_stop: float = 1,
enclosure: LayerEnclosure | None = None,
) -> KCell:
"""Creat a bezier bend.
Args:
width: Width of the core. [um]
height: height difference of left/right. [um]
length: Length of the bend. [um]
layer: Layer index of the core.
nb_points: Number of points of the backbone.
t_start: start
t_stop: end
enclosure: Slab/Exclude definition. [dbu]
"""
c = KCell()
_length, _height = length, height
pts = bezier_curve(
control_points=[
(0.0, 0.0),
(_length / 2, 0.0),
(_length / 2, _height),
(_length, _height),
],
t=np.linspace(t_start, t_stop, nb_points),
)
extrude_path(c, path=pts, layer=layer, width=width, start_angle=0, end_angle=0)
if enclosure:
enclosure.extrude_path(c, pts, layer, width, start_angle=0, end_angle=0)
# enclosure.apply_minkowski_tiled(c)
# enclosure.apply_bbox(c)
bbox_layer = c.bbox_per_layer(layer)
c.create_port(
name="o1",
width=int(width / c.kcl.dbu),
trans=kdb.Trans(2, True, 0, 0),
layer=layer,
port_type="optical",
)
c.create_port(
name="o2",
width=int(width / c.kcl.dbu),
trans=kdb.Trans(
0, False, bbox_layer.right, bbox_layer.top - int(width / c.kcl.dbu) // 2
),
layer=layer,
port_type="optical",
)
c.info["sim"] = "FDTD"
return c
if __name__ == "__main__":
import kfactory as kf
from kgeneric import LAYER
um = 1 / kf.kcl.dbu
enclosure = LayerEnclosure(
[
(LAYER.DEEPTRENCH, 2 * um, 3 * um),
(LAYER.SLAB90, 2 * um),
],
name="WGSLAB",
main_layer=LAYER.WG,
)
c = bend_s(width=0.25, height=2, length=1, layer=LAYER.WG, enclosure=enclosure)
c.draw_ports()
c.show()
|
kgeneric/kgeneric/cells/bezier.py/0
|
{
"file_path": "kgeneric/kgeneric/cells/bezier.py",
"repo_id": "kgeneric",
"token_count": 1436
}
| 116
|
import kfactory as kf
from kgeneric import gpdk as pdk
if __name__ == "__main__":
c = kf.KCell("bend_chain")
b1 = c << pdk.bend_euler_sc(angle=37)
b2 = c << pdk.bend_euler_sc(angle=37)
b2.connect("o1", b1.ports["o2"])
# b1.flatten()
# b2.flatten()
# c.shapes.(10)
c.flatten()
c.show()
|
kgeneric/kgeneric/samples/bend_chain.py/0
|
{
"file_path": "kgeneric/kgeneric/samples/bend_chain.py",
"repo_id": "kgeneric",
"token_count": 168
}
| 117
|
[bumpversion]
current_version = 0.1.13
commit = True
tag = True
[bumpversion:file:./setup.py]
[bumpversion:file:./docs/conf.py]
[bumpversion:file:./README.md]
[bumpversion:file:klayout_package/python/klayout_pyxs/__init__.py]
[bumpversion:file:klayout_package/grain.xml]
|
klayout_pyxs/.bumpversion.cfg/0
|
{
"file_path": "klayout_pyxs/.bumpversion.cfg",
"repo_id": "klayout_pyxs",
"token_count": 115
}
| 118
|
.. _DocReference:
PYXS File Reference
===================
This document details the functions available in PYXS scripts. An
introduction is available as a separate document:
:doc:`DocIntro`.
In PYXS scripts, there are basically three kind of functions and
methods:
* Standalone functions which don't require an object. For example
``input()`` and ``deposit()``.
* Methods on original layout layers (and in some weaker sense on
material data objects), i.e. ``invert()`` or ``not_()``.
* Methods on mask data objects, i.e. ``grow()`` and ``etch()``.
Functions
---------
The following standalone functions are available:
.. list-table::
:widths: 15 70
:header-rows: 1
* - Function
- Description
* - ``all()``
- Return a pseudo-mask, covering the whole wafer
* - ``below(b)``
- | Configure the lower height of the processing window for
| backside processing (see below)
* - ``bulk()``
- Return a pseudo-material describing the wafer body
* - ``delta(d)``
- Configure the accuracy parameter (see ``below()``)
* - | ``deposit(...)``
| ``grow()``
| ``diffuse()``
- | Deposit material as a uniform sheet. Equivalent to
| ``all().grow(...)``. Return a material data object
* - ``depth(d)``
- | Configure the depth of the processing window or the wafer
| thickness for backside processing (see below)
* - ``etch(...)``
- Uniform etching. Equivalent to ``all.etch(...)``
* - ``extend(x)``
- Configure the computation margin (see below)
* - ``flip()``
- Start or end backside processing
* - ``height(h)``
- Configure the height of the processing window (see below)
* - ``layer(layer_spec)``
- | Fetche an input layer from the original layout. Return a
| layer data object.
* - ``layers_file(lyp_filename)``
- | Configure a ``.lyp`` layer properties file to be used on the
| cross-section layout
* - ``mask(layout_data)``
- | Designate the ``layout_data`` object as a litho pattern (mask).
| This is the starting point for structured grow or etch
| operations. Return a mask data object.
* - ``output(layer_spec, material)``
- Output a material object to the output layout
* - ``planarize(...)``
- Planarization
``all()`` method
^^^^^^^^^^^^^^^^
This method delivers a mask data object which covers the whole wafer.
It's used as seed for the global etch and grow function only.
``below()``, ``depth()`` and ``height()`` methods
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The material operations a performed in a limited processing window,
which extends a certain height over the wafer top surface (``height``),
covers the wafer with a certain depth (``depth``) and extends below the
wafer for backside processing (``below`` parameter). Material cannot grow
outside the space above or below the wafer. Etching cannot happen
deeper than ``depth``. For backside processing, ``depth`` also defines the
wafer thickness.
The parameters can be modified with the respective functions. All
functions accept a value in micrometer units. The default value is
2 micrometers.
``bulk()`` method
^^^^^^^^^^^^^^^^^
This methods returns a material data object which represents the wafer
at it's initial state. This object can be used to represent the
unmodified wafer substrate and can be target of etch operations. Every
call of ``bulk()`` will return a fresh object, so the object needs to be
stored in a variable for later use:
.. code-block:: python
substrate = bulk()
mask(layer).etch(0.5, into='substrate')
output("1/0", substrate)
``delta()`` method
^^^^^^^^^^^^^^^^^^
Due to limitations of the underlying processor which cannot handle
infinitely thin polygons, there is an accuracy limit for the creation
or modification or geometrical regions. The delta parameter will
basically determine that accuracy level and in some cases, for example
the sheet thickness will only be accurate to that level. In addition,
healing or small gaps and slivers during the processing uses the delta
value as a dimension threshold, so shapes or gaps smaller than that
value cannot be produced.
The default value of ``delta`` is 10 database units. To modify the value,
call the ``delta()`` function with the desired delta value in micrometer
units. The minimum value recommended is 2 database unit. That implies
that the accuracy can be increased by using a smaller database unit for
the input layout.
``deposit()`` (``grow()``, ``diffuse()``) methods
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This function will deposit material uniformly. ``grow()`` and ``diffuse()``
are just synonyms. It is equivalent to ``all.grow(...)``. For a
description of the parameters see the ``grow()`` method on the mask data
object.
The ``deposit()`` function will return a material object representing the
deposited material.
``etch()`` method
^^^^^^^^^^^^^^^^^
This function will perform a uniform etch and is equivalent to
``all().etch(...)``. For a description of the parameter see the
"etch()" function on the mask data object.
``extend()`` method
^^^^^^^^^^^^^^^^^^^
To reduce the likelihood of missing important features, the cross
section script will sample the layout in a window around the cut line.
The dimensions of that window are controlled by the ``extend`` parameter.
The window extends the specified value to the left, the right, the start
and end of the cut line.
The default value is 2 micrometers. To catch all relevant input data in
cases where positive sizing values larger than the extend parameter are
used, increase the extend value by calling ``extend(e)`` with the desired
value in micrometer units.
In addition, the ``extend`` parameter determines the extension of an
invisible part left and right of the cross section, which is included
in the processing to reduce border effects. If deposition or etching
happens with dimensions bigger than the extend value, artifacts start
to appear at the borders of the simulation window. The extend value can
then be increased to hide these effects.
``flip()`` method
^^^^^^^^^^^^^^^^^
This function will start backside processing. After this function,
modifications will be applied on the back side of the wafer. Calling
``flip()`` again, will continue processing on the front side.
``layer()`` method
^^^^^^^^^^^^^^^^^^
The layer method fetches a layout layer and prepares a layout data
object for further processing. The ``layer()`` function expects a single
string parameter which encodes the source of the layout data.
The function understands the following variants:
* ``layer("17")``: Layer 17, datatype 0
* ``layer("17/6")``: Layer 17, datatype 6
* ``layer("METAL1")``: layer "METAL1" for formats that support
named layers (DXF, CIF)
* ``layer("METAL1 (17/0)")``: hybrid specification for GDS
(layer 17, datatype 0) and "METAL1" for named-layer formats like DXF
and CIF.
``layers_file()`` method
^^^^^^^^^^^^^^^^^^^^^^^^
This function specifies a layer properties file which will be loaded
when the cross section has been generated. This file specifies colors,
fill pattern and other parameters of the display:
.. code-block:: python
layers_file("/home/matthias/xsection/lyp_files/cmos1.lyp")
``mask()`` method
^^^^^^^^^^^^^^^^^
The ``mask()`` function designates the given layout data object as a litho
mask. It returns a mask data object which is the starting point for
further ``etch()`` or ``grow()`` operations:
.. code-block:: python
l1 = layer("1/0")
metal = mask(l1).grow(0.3)
output("1/0", metal)
``output()`` method
^^^^^^^^^^^^^^^^^^^
The ``output()`` function will write the given material to the output
layout. The function expects two parameters: an output layer
specification and a material object:
.. code-block:: python
output("1/0", metal)
The layer specifications follow the same rules than for the ``layer()``
function described above.
``planarize()`` method
^^^^^^^^^^^^^^^^^^^^^^
The ``planarize()`` function removes material of the given kind (``into``
argument) down to a certain level. The level can be determined
numerically or by a stop layer.
The function takes a couple of keyword parameters in the Python notation
(``name=value``), for example:
.. code-block:: python
planarize(downto=substrate, into=metal)
planarize(less=0.5, into=[metal, substrate])
The keyword parameters are:
.. list-table::
:widths: 10 70
:header-rows: 1
* - Name
- Description
* - ``into``
- | (mandatory) A single material or an array or materials. The
| planarization will remove these materials selectively.
* - ``downto``
- | Value is a material. Planarization stops at the topmost point
| of that material. Cannot be used together with ``less`` or ``to``.
* - ``less``
- | Value is a micrometer distance. Planarization will remove a
| horizontal alice of the given material, stopping ``less``
| micrometers measured from the topmost point of that material
| before the planarization. Cannot be used together with ``downto``
| or ``to``.
* - ``to``
- | Value is micrometer z value. Planarization stops when reaching
| that value. The z value is measured from the initial wafer
| surface. Cannot be used together with ``downto`` or ``less``.
Methods on original layout layers or material data objects
----------------------------------------------------------
The following methods are available for these objects:
.. list-table::
:widths: 15 60
:header-rows: 1
* - Method
- Description
* - ``size(s)`` or ``size(x, y)``
- Isotropic or anisotropic sizing
* - ``sized(s)`` or ``sized(x, y)``
- Out-of-place version of ``size()``
* - ``invert()``
- Invert a layer
* - ``inverted()``
- Out-of-place version of ``invert()``
* - ``or_(other)``
- Boolean OR (merging) with another layer
* - ``and_(other)``
- Boolean AND (intersection) with another layer
* - ``xor(other)``
- Boolean XOR (symmetric difference) with another layer
* - ``not_(other)``
- Boolean NOT (difference) with another layer
``size()`` method
^^^^^^^^^^^^^^^^^^^^^^
This method will apply a bias to the layout data. A bias is applied by
shifting the edges to the outside (for positive bias) or the inside
(for negative bias) of the figure.
Applying a bias will increase or reduce the dimension of a figure by
twice the value.
Two versions are available: isotropic or anisotropic sizing. The first
version takes one single value in micrometer units and applies this value
in x and y direction. The second version takes two values for x and y
direction.
The ``size()`` method will modify the layer object (in-place). A
non-modifying version (out-of-place) is ``sized()``.
.. code-block:: python
l1 = layer("1/0")
l1.size(0.3)
metal = mask(l1).grow(0.3)
``sized()`` method
^^^^^^^^^^^^^^^^^^
Same as ``size()``, but returns a new layout data object rather than
modifying it:
.. code-block:: python
l1 = layer("1/0")
l1_sized = l1.sized(0.3)
metal = mask(l1_sized).grow(0.3)
# l1 can still be used in the original form
``invert()`` method
^^^^^^^^^^^^^^^^^^^
Inverts a layer (creates layout where nothing is drawn and vice versa).
This method modifies the layout data object (in-place):
.. code-block:: python
l1 = layer("1/0")
l1.invert()
metal = mask(l1).grow(0.3)
A non-modifying version (out-of-place) is ``inverted()``.
``inverted()`` method
^^^^^^^^^^^^^^^^^^^^^
Returns a new layout data object representing the inverted source
layout:
.. code-block:: python
l1 = layer("1/0")
l1_inv = l1.inverted()
metal = mask(l1_inv).grow(0.3)
# l1 can still be used in the original form
``or_()``, ``and_()``, ``xor()``, ``not_()`` methods
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
These methods perform boolean operations. Their notation is somewhat
unusual but follows the method notation of Python:
.. code-block:: python
l1 = layer("1/0")
l2 = layer("2/0")
one_of_them = l1.xor(l2)
Here is the output of the operations:
.. list-table::
:widths: 10 10 15 15 15 15
:header-rows: 1
* - layer ``a``
- layer ``b``
- ``a.or_(b)``
- ``a.and_(b)``
- ``a.xor(b)``
- ``a.not_(b)``
* - clear
- clear
- clear
- clear
- clear
- clear
* - drawn
- clear
- drawn
- clear
- drawn
- drawn
* - clear
- drawn
- drawn
- clear
- drawn
- clear
* - drawn
- drawn
- drawn
- drawn
- clear
- clear
Methods on mask data objects: ``grow()`` and ``etch()``
-------------------------------------------------------
The following methods are available for mask data objects:
.. list-table::
:widths: 15 60
:header-rows: 1
* - Method
- Description
* - ``grow(...)``
- Deposition of material where this mask is present
* - ``etch(...)``
- Removal of material where this mask is present
``grow()`` method
^^^^^^^^^^^^^^^^^
This method is important and has a rich parameter set, so it is
described in an individual document here: :doc:`DocGrow`.
``etch()`` method
^^^^^^^^^^^^^^^^^
This method is important and has a rich parameter set, so it is
described in an individual document here: :doc:`DocEtch`.
|
klayout_pyxs/docs/DocReference.rst/0
|
{
"file_path": "klayout_pyxs/docs/DocReference.rst",
"repo_id": "klayout_pyxs",
"token_count": 4280
}
| 119
|
<?xml version="1.0" encoding="utf-8"?>
<klayout-macro>
<description/>
<version/>
<category>pymacros</category>
<prolog/>
<epilog/>
<doc/>
<autorun>true</autorun>
<autorun-early>false</autorun-early>
<shortcut/>
<show-in-menu>false</show-in-menu>
<group-name/>
<menu-path/>
<interpreter>python</interpreter>
<dsl-interpreter-name/>
<text># import sys
# fpath = 'D:/Docs/TUe/Projects/!!python_projects/klayout_prj/klayout_pyxs_repo/'
# if not fpath in sys.path:
# sys.path.insert(0, fpath)
# from pprint import pprint
# pprint(sys.path)
# import klayout_pyxs.pyxs_lib as pyxs_lib
from __future__ import print_function
from __future__ import absolute_import
from klayout_pyxs import XSectionScriptEnvironment
# import importlib
# importlib.reload(klayout.pyxs_lib)
pyxs_processing_environment = XSectionScriptEnvironment('pyxs')
DEBUG = False
if DEBUG:
print('xs_run:', xs_run)
print('xs_cut:', xs_cut)
print('xs_out:', xs_out)
print('RBA::LayoutView::current', pya.LayoutView.current())
if pya.LayoutView.current() and xs_run and xs_cut and xs_out:
x1, x2 = xs_cut.split(';')[0].split(',')
x3, x4 = xs_cut.split(';')[1].split(',')
if DEBUG:
print(x1, x2, x3, x4)
p1 = pya.DPoint(float(x1), float(x2))
p2 = pya.DPoint(float(x3), float(x4))
print("Running pyxs script {} with {} to {} ...".format(xs_run, p1, p2))
target_view = pyxs_processing_environment.run_script(xs_run, p1, p2)[-1]
l = target_view.active_cellview().layout()
print("Writing {} ...".format(xs_out))
l.write(xs_out)
</text>
</klayout-macro>
|
klayout_pyxs/klayout_package/pymacros/pyxs.lym/0
|
{
"file_path": "klayout_pyxs/klayout_package/pymacros/pyxs.lym",
"repo_id": "klayout_pyxs",
"token_count": 678
}
| 120
|
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# This script produces the documentation images.
# Use makedoc.sh to run it.
def configure_view(view)
view.set_config("grid-micron", "0.1")
view.set_config("background-color", "#000000")
view.set_config("grid-color", "#303030")
view.set_config("grid-show-ruler", "true")
view.set_config("grid-style0", "invisible")
view.set_config("grid-style1", "light-dotted-lines")
view.set_config("grid-style2", "light-dotted-lines")
view.set_config("grid-visible", "true")
end
def configure_view_xs(view)
view.set_config("grid-micron", "0.1")
view.set_config("background-color", "#000000")
view.set_config("grid-color", "#404040")
view.set_config("grid-show-ruler", "true")
view.set_config("grid-style0", "invisible")
view.set_config("grid-style1", "invisible")
view.set_config("grid-style2", "invisible")
view.set_config("grid-visible", "true")
end
screenshot_width = 640
screenshot_height = 400
app = RBA::Application::instance
mw = app.main_window
# -------------------------------------------------------------------
# Sample 1
sample = "s1"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(0, -600, 400, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Prepare input layers
m1 = layer("1/0")
# "grow" metal on mask m1 with thickness 0.3 and lateral extension 0.1
# with elliptical edge contours
metal1 = mask(m1).grow(0.3, 0.1, :mode => :round)
# output the material data to the target layout
output("0/0", bulk)
output("1/0", metal1)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, -0.15)
ant.p2 = RBA::DPoint::new(1.0, -0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, 0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, -0.2)
ant.p2 = RBA::DPoint::new(0.4, 0.05)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.2)
ant.p2 = RBA::DPoint::new(1.0, 0.05)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.5, -0.05)
ant.p2 = RBA::DPoint::new(0.5, 0.05)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.9, -0.05)
ant.p2 = RBA::DPoint::new(0.9, 0.05)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.9, 0)
ant.p2 = RBA::DPoint::new(0.5, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, 0.3)
ant.p2 = RBA::DPoint::new(1.25, 0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Sample 2
sample = "s2"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-200, -600, 600, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Prepare input layers
m1 = layer("1/0").inverted
# deposit metal with width 0.25 micron
metal1 = deposit(0.25)
substrate = bulk
# etch metal on mask m1 with thickness 0.3 and lateral extension 0.1
# with elliptical edge contours
mask(m1).etch(0.3, 0.1, :mode => :round, :into => [ metal1, substrate ])
# output the material data to the target layout
output("0/0", substrate)
output("1/0", metal1)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.35)
ant.p2 = RBA::DPoint::new(1.0, 0.35)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, 0.25)
ant.p2 = RBA::DPoint::new(1.2, -0.05)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.2)
ant.p2 = RBA::DPoint::new(0.4, 0.4)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.2)
ant.p2 = RBA::DPoint::new(1.0, 0.4)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.3, 0)
ant.p2 = RBA::DPoint::new(0.3, -0.25)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, 0)
ant.p2 = RBA::DPoint::new(1.1, -0.25)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, -0.2)
ant.p2 = RBA::DPoint::new(0.3, -0.2)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, 0.25)
ant.p2 = RBA::DPoint::new(1.25, 0.25)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Sample 3
sample = "s3"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-200, -600, 600, 600))
l2 = main_ly.layer(2, 0)
main_top.shapes(l2).insert(RBA::Box::new(0, -200, 400, 200))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 9
lp.fill_color = 0x8080ff
lp.frame_color = lp.fill_color
lp.source_layer = 2
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0").inverted
m2 = layer("2/0")
# deposit metal with width 0.25 micron
metal1 = deposit(0.25)
substrate = bulk
# etch metal on mask m1 with thickness 0.3 and lateral extension 0.1
# with elliptical edge contours
mask(m1).etch(0.3, 0.1, :mode => :round, :into => [ metal1, substrate ])
# process from the backside
flip
# backside etch, taper angle 4 degree
mask(m2).etch(1, :taper => 4, :into => substrate)
# fill with metal and polish
metal2 = deposit(0.3, 0.3, :mode => :square)
planarize(:downto => substrate, :into => metal2)
# output the material data to the target layout
output("0/0", substrate)
output("1/0", metal1.or(metal2))
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -1.3, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.35)
ant.p2 = RBA::DPoint::new(1.0, 0.35)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, 0.25)
ant.p2 = RBA::DPoint::new(1.2, -0.05)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.2)
ant.p2 = RBA::DPoint::new(0.4, 0.4)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.2)
ant.p2 = RBA::DPoint::new(1.0, 0.4)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.3, 0)
ant.p2 = RBA::DPoint::new(0.3, -0.25)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, 0)
ant.p2 = RBA::DPoint::new(1.1, -0.25)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, -0.2)
ant.p2 = RBA::DPoint::new(0.3, -0.2)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, 0.25)
ant.p2 = RBA::DPoint::new(1.25, 0.25)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.9, -0.9)
ant.p2 = RBA::DPoint::new(0.9, -1.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.5, -0.9)
ant.p2 = RBA::DPoint::new(0.5, -1.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.9, -1.15)
ant.p2 = RBA::DPoint::new(0.5, -1.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc grow sample 1
sample = "g1"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
metal = mask(m1).grow(0.3)
# output the material data to the target layout
output("0/0", bulk)
output("1/0", metal)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.4)
ant.p2 = RBA::DPoint::new(0.4, 0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.25)
ant.p2 = RBA::DPoint::new(0.4, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.25)
ant.p2 = RBA::DPoint::new(1.0, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, 0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, 0.3)
ant.p2 = RBA::DPoint::new(1.25, 0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.05)
ant.p2 = RBA::DPoint::new(0.4, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.05)
ant.p2 = RBA::DPoint::new(1.0, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.15)
ant.p2 = RBA::DPoint::new(0.4, -0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc grow sample 2
sample = "g2"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
metal = mask(m1).grow(0.3, 0.1)
# output the material data to the target layout
output("0/0", bulk)
output("1/0", metal)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, 0.4)
ant.p2 = RBA::DPoint::new(0.3, 0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.3, 0.25)
ant.p2 = RBA::DPoint::new(0.3, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, 0.25)
ant.p2 = RBA::DPoint::new(1.1, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, 0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, 0.3)
ant.p2 = RBA::DPoint::new(1.25, 0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.05)
ant.p2 = RBA::DPoint::new(0.4, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.05)
ant.p2 = RBA::DPoint::new(1.0, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.15)
ant.p2 = RBA::DPoint::new(0.4, -0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc grow sample 3
sample = "g3"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
metal = mask(m1).grow(0.3, 0.1, :mode => :round)
# output the material data to the target layout
output("0/0", bulk)
output("1/0", metal)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, 0.4)
ant.p2 = RBA::DPoint::new(0.3, 0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.3, 0.2)
ant.p2 = RBA::DPoint::new(0.3, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, 0.2)
ant.p2 = RBA::DPoint::new(1.1, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, 0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, 0.3)
ant.p2 = RBA::DPoint::new(1.25, 0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.05)
ant.p2 = RBA::DPoint::new(0.4, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.05)
ant.p2 = RBA::DPoint::new(1.0, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.15)
ant.p2 = RBA::DPoint::new(0.4, -0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc grow sample 4
sample = "g4"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
metal = mask(m1).grow(0.3, -0.1, :mode => :round)
# output the material data to the target layout
output("0/0", bulk)
output("1/0", metal)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.9, 0.4)
ant.p2 = RBA::DPoint::new(0.5, 0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.5, 0.25)
ant.p2 = RBA::DPoint::new(0.5, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.9, 0.25)
ant.p2 = RBA::DPoint::new(0.9, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, 0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, 0.3)
ant.p2 = RBA::DPoint::new(1.25, 0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.05)
ant.p2 = RBA::DPoint::new(0.4, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.05)
ant.p2 = RBA::DPoint::new(1.0, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.15)
ant.p2 = RBA::DPoint::new(0.4, -0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc grow sample 5
sample = "g5"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
metal = mask(m1).grow(0.3, 0.1, :mode => :octagon)
# output the material data to the target layout
output("0/0", bulk)
output("1/0", metal)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, 0.4)
ant.p2 = RBA::DPoint::new(0.3, 0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.3, 0.2)
ant.p2 = RBA::DPoint::new(0.3, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, 0.2)
ant.p2 = RBA::DPoint::new(1.1, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, 0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, 0.3)
ant.p2 = RBA::DPoint::new(1.25, 0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.05)
ant.p2 = RBA::DPoint::new(0.4, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.05)
ant.p2 = RBA::DPoint::new(1.0, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.15)
ant.p2 = RBA::DPoint::new(0.4, -0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc grow sample 6
sample = "g6"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
metal = mask(m1).grow(0.3, 0.1, :mode => :round, :bias => 0.05)
# output the material data to the target layout
output("0/0", bulk)
output("1/0", metal)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, 0.4)
ant.p2 = RBA::DPoint::new(0.35, 0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.35, 0.2)
ant.p2 = RBA::DPoint::new(0.35, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, 0.2)
ant.p2 = RBA::DPoint::new(1.05, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, 0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, 0.3)
ant.p2 = RBA::DPoint::new(1.25, 0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.05)
ant.p2 = RBA::DPoint::new(0.4, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.05)
ant.p2 = RBA::DPoint::new(1.0, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.15)
ant.p2 = RBA::DPoint::new(0.4, -0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc grow sample 7
sample = "g7"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
metal = mask(m1).grow(0.3, :taper => 10)
# output the material data to the target layout
output("0/0", bulk)
output("1/0", metal)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.95, 0.4)
ant.p2 = RBA::DPoint::new(0.45, 0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " 0.6 - 2 x 10°"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.45, 0.25)
ant.p2 = RBA::DPoint::new(0.45, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.95, 0.25)
ant.p2 = RBA::DPoint::new(0.95, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, 0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, 0.3)
ant.p2 = RBA::DPoint::new(1.25, 0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.05)
ant.p2 = RBA::DPoint::new(0.4, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.05)
ant.p2 = RBA::DPoint::new(1.0, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.15)
ant.p2 = RBA::DPoint::new(0.4, -0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc grow sample 8
sample = "g8"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
metal = mask(m1).grow(0.3, :taper => 10, :bias => -0.1)
# output the material data to the target layout
output("0/0", bulk)
output("1/0", metal)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, 0.4)
ant.p2 = RBA::DPoint::new(0.35, 0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " 0.8 - 2 x 10°"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.35, 0.25)
ant.p2 = RBA::DPoint::new(0.35, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, 0.25)
ant.p2 = RBA::DPoint::new(1.05, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, 0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, 0.3)
ant.p2 = RBA::DPoint::new(1.25, 0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.05)
ant.p2 = RBA::DPoint::new(0.4, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.05)
ant.p2 = RBA::DPoint::new(1.0, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.15)
ant.p2 = RBA::DPoint::new(0.4, -0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc grow sample 9
if false # does not work as expected yet
sample = "g9"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
metal = mask(m1).grow(0.3, :taper => -10)
# output the material data to the target layout
output("0/0", bulk)
output("1/0", metal)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, 0.4)
ant.p2 = RBA::DPoint::new(0.35, 0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " 0.8 - 2 x 10°"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.35, 0.25)
ant.p2 = RBA::DPoint::new(0.35, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, 0.25)
ant.p2 = RBA::DPoint::new(1.05, 0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, 0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, 0.3)
ant.p2 = RBA::DPoint::new(1.25, 0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.05)
ant.p2 = RBA::DPoint::new(0.4, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.05)
ant.p2 = RBA::DPoint::new(1.0, -0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.15)
ant.p2 = RBA::DPoint::new(0.4, -0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
end
# -------------------------------------------------------------------
# Doc grow sample 10
sample = "g10"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 800, 600))
l2 = main_ly.layer(2, 0)
main_top.shapes(l2).insert(RBA::Box::new(-1000, -600, 0, 600))
l3 = main_ly.layer(3, 0)
main_top.shapes(l3).insert(RBA::Box::new(600, -600, 2000, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
m2 = layer("2/0")
m3 = layer("3/0")
substrate = bulk
mask(m2).etch(0.5, :into => substrate, :taper => 30)
mask(m3).etch(0.5, :into => substrate)
metal = mask(m1).grow(0.3, 0.1, :mode => :round)
# output the material data to the target layout
output("0/0", substrate)
output("1/0", metal)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.3, 0.2)
ant.p2 = RBA::DPoint::new(0.4, 0.2)
ant.style = RBA::Annotation::StyleArrowBoth
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.3, 0)
ant.p2 = RBA::DPoint::new(0.3, 0.25)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0)
ant.p2 = RBA::DPoint::new(0.4, 0.25)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.3)
ant.p2 = RBA::DPoint::new(1.3, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, 0.3)
ant.p2 = RBA::DPoint::new(1.35, 0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, 0)
ant.p2 = RBA::DPoint::new(1.35, 0)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.05)
ant.p2 = RBA::DPoint::new(0.4, -0.65)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, -0.15)
ant.p2 = RBA::DPoint::new(1.3, -0.65)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, -0.6)
ant.p2 = RBA::DPoint::new(0.4, -0.6)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
if false # does not work well
# -------------------------------------------------------------------
# Doc grow sample 11
sample = "g11"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 800, 600))
l2 = main_ly.layer(2, 0)
main_top.shapes(l2).insert(RBA::Box::new(-1000, -600, 0, 600))
l3 = main_ly.layer(3, 0)
main_top.shapes(l3).insert(RBA::Box::new(600, -600, 2000, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
m2 = layer("2/0")
m3 = layer("3/0")
substrate = bulk
mask(m2).etch(0.5, :into => substrate, :taper => 30)
mask(m3).etch(0.5, :into => substrate)
metal = mask(m1).grow(0.3, 0.1, :taper => 20)
# output the material data to the target layout
output("0/0", substrate)
output("1/0", metal)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.3, 0.2)
ant.p2 = RBA::DPoint::new(0.4, 0.2)
ant.style = RBA::Annotation::StyleArrowBoth
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.3, 0)
ant.p2 = RBA::DPoint::new(0.3, 0.25)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0)
ant.p2 = RBA::DPoint::new(0.4, 0.25)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.3)
ant.p2 = RBA::DPoint::new(1.3, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, 0.3)
ant.p2 = RBA::DPoint::new(1.35, 0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, 0)
ant.p2 = RBA::DPoint::new(1.35, 0)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.05)
ant.p2 = RBA::DPoint::new(0.4, -0.65)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, -0.15)
ant.p2 = RBA::DPoint::new(1.3, -0.65)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, -0.6)
ant.p2 = RBA::DPoint::new(0.4, -0.6)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
end
# -------------------------------------------------------------------
# Doc grow sample 12
sample = "g12"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 800, 600))
l2 = main_ly.layer(2, 0)
main_top.shapes(l2).insert(RBA::Box::new(-200, -600, 400, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 9
lp.fill_color = 0x8080ff
lp.frame_color = lp.fill_color
lp.source_layer = 2
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
m2 = layer("2/0")
# Grow a stop layer
stop = mask(m2).grow(0.05)
# Grow with mask m1, but only where there is a substrate surface
metal = mask(m1).grow(0.3, 0.1, :mode => :round, :on => bulk)
# output the material data to the target layout
output("0/0", bulk)
output("1/0", metal)
output("2/0", stop)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 9
lp.fill_color = 0x8080ff
lp.frame_color = lp.fill_color
lp.source_layer = 2
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.6, 0.3)
ant.p2 = RBA::DPoint::new(1.6, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.25, 0.3)
ant.p2 = RBA::DPoint::new(1.65, 0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.15)
ant.p2 = RBA::DPoint::new(0.4, -0.25)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.15)
ant.p2 = RBA::DPoint::new(1.3, -0.25)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, -0.2)
ant.p2 = RBA::DPoint::new(0.4, -0.2)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc grow sample 13
sample = "g13"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 800, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
m2 = layer("2/0")
substrate = bulk
# Grow with mask m1 into the substrate
metal = mask(m1).grow(0.3, 0.1, :mode => :round, :into => substrate)
# output the material data to the target layout
output("0/0", substrate)
output("1/0", metal)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 9
lp.fill_color = 0x8080ff
lp.frame_color = lp.fill_color
lp.source_layer = 2
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.6, 0)
ant.p2 = RBA::DPoint::new(1.6, -0.3)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.25, -0.3)
ant.p2 = RBA::DPoint::new(1.65, -0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.2)
ant.p2 = RBA::DPoint::new(0.4, -0.4)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.2)
ant.p2 = RBA::DPoint::new(1.3, -0.4)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.15)
ant.p2 = RBA::DPoint::new(0.4, 0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc grow sample 14
sample = "g14"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 800, 600))
l2 = main_ly.layer(2, 0)
main_top.shapes(l2).insert(RBA::Box::new(-300, -600, 400, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 9
lp.fill_color = 0x8080ff
lp.frame_color = lp.fill_color
lp.source_layer = 2
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
m2 = layer("2/0")
substrate = bulk
stop = mask(m2).grow(0.05, :into => substrate)
# Grow with mask m1 into the substrate
metal = mask(m1).grow(0.3, 0.1, :mode => :round, :through => stop, :into => substrate)
# output the material data to the target layout
output("0/0", substrate)
output("1/0", metal)
output("2/0", stop)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 9
lp.fill_color = 0x8080ff
lp.frame_color = lp.fill_color
lp.source_layer = 2
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.6, 0)
ant.p2 = RBA::DPoint::new(1.6, -0.3)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, -0.3)
ant.p2 = RBA::DPoint::new(1.65, -0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.2)
ant.p2 = RBA::DPoint::new(0.4, -0.4)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.2)
ant.p2 = RBA::DPoint::new(1.3, -0.4)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.15)
ant.p2 = RBA::DPoint::new(0.4, 0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc grow sample 15
sample = "g15"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 800, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
m2 = layer("2/0")
substrate = bulk
# Grow with mask m1 into the substrate
metal = mask(m1).grow(0.3, 0.1, :mode => :round, :into => substrate, :buried => 0.4)
# output the material data to the target layout
output("0/0", substrate)
output("1/0", metal)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.8, 2.1, 0.3))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 9
lp.fill_color = 0x8080ff
lp.frame_color = lp.fill_color
lp.source_layer = 2
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.6, 0)
ant.p2 = RBA::DPoint::new(1.6, -0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.25, -0.4)
ant.p2 = RBA::DPoint::new(1.65, -0.4)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.2)
ant.p2 = RBA::DPoint::new(0.4, -0.5)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.2)
ant.p2 = RBA::DPoint::new(1.3, -0.5)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.15)
ant.p2 = RBA::DPoint::new(0.4, 0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc etch sample 1
sample = "e1"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
substrate = bulk
mask(m1).etch(0.3, :into => substrate)
# output the material data to the target layout
output("0/0", substrate)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.4)
ant.p2 = RBA::DPoint::new(0.4, -0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, -0.25)
ant.p2 = RBA::DPoint::new(0.4, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.25)
ant.p2 = RBA::DPoint::new(1.0, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, -0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, -0.3)
ant.p2 = RBA::DPoint::new(1.25, -0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, -0.05)
ant.p2 = RBA::DPoint::new(0.4, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.05)
ant.p2 = RBA::DPoint::new(1.0, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.15)
ant.p2 = RBA::DPoint::new(0.4, 0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc etch sample 2
sample = "e2"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
substrate = bulk
mask(m1).etch(0.3, 0.1, :into => substrate)
# output the material data to the target layout
output("0/0", substrate)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, -0.4)
ant.p2 = RBA::DPoint::new(0.3, -0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.3, -0.25)
ant.p2 = RBA::DPoint::new(0.3, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, -0.25)
ant.p2 = RBA::DPoint::new(1.1, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, -0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, -0.3)
ant.p2 = RBA::DPoint::new(1.25, -0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, -0.05)
ant.p2 = RBA::DPoint::new(0.4, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.05)
ant.p2 = RBA::DPoint::new(1.0, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.15)
ant.p2 = RBA::DPoint::new(0.4, 0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc etch sample 3
sample = "e3"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
substrate = bulk
mask(m1).etch(0.3, 0.1, :mode => :round, :into => substrate)
# output the material data to the target layout
output("0/0", substrate)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, -0.4)
ant.p2 = RBA::DPoint::new(0.3, -0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.3, -0.2)
ant.p2 = RBA::DPoint::new(0.3, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, -0.2)
ant.p2 = RBA::DPoint::new(1.1, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, -0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, -0.3)
ant.p2 = RBA::DPoint::new(1.25, -0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, -0.05)
ant.p2 = RBA::DPoint::new(0.4, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.05)
ant.p2 = RBA::DPoint::new(1.0, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.15)
ant.p2 = RBA::DPoint::new(0.4, 0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc etch sample 4
sample = "e4"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
substrate = bulk
mask(m1).etch(0.3, -0.1, :mode => :round, :into => substrate)
# output the material data to the target layout
output("0/0", substrate)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.9, -0.4)
ant.p2 = RBA::DPoint::new(0.5, -0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.5, -0.25)
ant.p2 = RBA::DPoint::new(0.5, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.9, -0.25)
ant.p2 = RBA::DPoint::new(0.9, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, -0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, -0.3)
ant.p2 = RBA::DPoint::new(1.25, -0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, -0.05)
ant.p2 = RBA::DPoint::new(0.4, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.05)
ant.p2 = RBA::DPoint::new(1.0, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.15)
ant.p2 = RBA::DPoint::new(0.4, 0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc etch sample 5
sample = "e5"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
substrate = bulk
mask(m1).etch(0.3, 0.1, :mode => :octagon, :into => substrate)
# output the material data to the target layout
output("0/0", substrate)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, -0.4)
ant.p2 = RBA::DPoint::new(0.3, -0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.3, -0.2)
ant.p2 = RBA::DPoint::new(0.3, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.1, -0.2)
ant.p2 = RBA::DPoint::new(1.1, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, -0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, -0.3)
ant.p2 = RBA::DPoint::new(1.25, -0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, -0.05)
ant.p2 = RBA::DPoint::new(0.4, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.05)
ant.p2 = RBA::DPoint::new(1.0, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.15)
ant.p2 = RBA::DPoint::new(0.4, 0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc etch sample 6
sample = "e6"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
substrate = bulk
mask(m1).etch(0.3, 0.1, :mode => :round, :bias => 0.05, :into => substrate)
# output the material data to the target layout
output("0/0", substrate)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, -0.4)
ant.p2 = RBA::DPoint::new(0.35, -0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.35, -0.2)
ant.p2 = RBA::DPoint::new(0.35, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, -0.2)
ant.p2 = RBA::DPoint::new(1.05, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, -0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, -0.3)
ant.p2 = RBA::DPoint::new(1.25, -0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, -0.05)
ant.p2 = RBA::DPoint::new(0.4, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.05)
ant.p2 = RBA::DPoint::new(1.0, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.15)
ant.p2 = RBA::DPoint::new(0.4, 0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc etch sample 7
sample = "e7"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
substrate = bulk
mask(m1).etch(0.3, :taper => 10, :into => substrate)
# output the material data to the target layout
output("0/0", substrate)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.95, -0.4)
ant.p2 = RBA::DPoint::new(0.45, -0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " 0.6 - 2 x 10°"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.45, -0.25)
ant.p2 = RBA::DPoint::new(0.45, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.95, -0.25)
ant.p2 = RBA::DPoint::new(0.95, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, -0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, -0.3)
ant.p2 = RBA::DPoint::new(1.25, -0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, -0.05)
ant.p2 = RBA::DPoint::new(0.4, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.05)
ant.p2 = RBA::DPoint::new(1.0, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.15)
ant.p2 = RBA::DPoint::new(0.4, 0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc etch sample 8
sample = "e8"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 500, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
substrate = bulk
mask(m1).etch(0.3, :taper => 10, :bias => -0.1, :into => substrate)
# output the material data to the target layout
output("0/0", substrate)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, -0.4)
ant.p2 = RBA::DPoint::new(0.35, -0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " 0.8 - 2 x 10°"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.35, -0.25)
ant.p2 = RBA::DPoint::new(0.35, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, -0.25)
ant.p2 = RBA::DPoint::new(1.05, -0.45)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.2, -0.3)
ant.p2 = RBA::DPoint::new(1.2, 0)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, -0.3)
ant.p2 = RBA::DPoint::new(1.25, -0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, -0.05)
ant.p2 = RBA::DPoint::new(0.4, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, -0.05)
ant.p2 = RBA::DPoint::new(1.0, 0.2)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.0, 0.15)
ant.p2 = RBA::DPoint::new(0.4, 0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc grow sample 10
sample = "e10"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 800, 600))
l2 = main_ly.layer(2, 0)
main_top.shapes(l2).insert(RBA::Box::new(-1000, -600, 0, 600))
l3 = main_ly.layer(3, 0)
main_top.shapes(l3).insert(RBA::Box::new(600, -600, 2000, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
substrate = bulk
# Prepare input layers
m1 = layer("1/0")
m2 = layer("2/0")
m3 = layer("3/0")
substrate = bulk
mask(m2).etch(0.5, :into => substrate, :taper => 30)
mask(m3).etch(0.5, :into => substrate)
os = substrate.dup
metal = mask(m1).etch(0.3, 0.1, :mode => :round, :into => substrate)
# output the material data to the target layout
output("0/0", substrate)
output("1/0", os)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -1.1, 2.1, 0))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 1
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.3, -0.1)
ant.p2 = RBA::DPoint::new(0.4, -0.1)
ant.style = RBA::Annotation::StyleArrowBoth
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.3, -0.3)
ant.p2 = RBA::DPoint::new(0.3, -0.05)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, -0.3)
ant.p2 = RBA::DPoint::new(0.4, -0.05)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0)
ant.p2 = RBA::DPoint::new(1.3, -0.3)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, 0)
ant.p2 = RBA::DPoint::new(1.35, 0)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.05, -0.3)
ant.p2 = RBA::DPoint::new(1.35, -0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.05)
ant.p2 = RBA::DPoint::new(0.4, -0.95)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, -0.45)
ant.p2 = RBA::DPoint::new(1.3, -0.95)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, -0.9)
ant.p2 = RBA::DPoint::new(0.4, -0.9)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc etch sample 12
sample = "e12"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 800, 600))
l2 = main_ly.layer(2, 0)
main_top.shapes(l2).insert(RBA::Box::new(-200, -600, 400, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 9
lp.fill_color = 0x8080ff
lp.frame_color = lp.fill_color
lp.source_layer = 2
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
m2 = layer("2/0")
substrate = bulk
# Grow a stop layer
stop = mask(m2).grow(0.05, :into => substrate)
# Grow with mask m1, but only where there is a substrate surface
mask(m1).etch(0.3, 0.1, :mode => :round, :into => substrate)
# output the material data to the target layout
output("0/0", substrate)
output("2/0", stop)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 9
lp.fill_color = 0x8080ff
lp.frame_color = lp.fill_color
lp.source_layer = 2
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.6, 0)
ant.p2 = RBA::DPoint::new(1.6, -0.3)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.25, -0.3)
ant.p2 = RBA::DPoint::new(1.65, -0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.2)
ant.p2 = RBA::DPoint::new(0.4, -0.05)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.2)
ant.p2 = RBA::DPoint::new(1.3, -0.4)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.15)
ant.p2 = RBA::DPoint::new(0.4, 0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc etch sample 13
sample = "e13"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 800, 600))
l2 = main_ly.layer(2, 0)
main_top.shapes(l2).insert(RBA::Box::new(-200, -600, 400, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 9
lp.fill_color = 0x8080ff
lp.frame_color = lp.fill_color
lp.source_layer = 2
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
m2 = layer("2/0")
substrate = bulk
# Grow a stop layer
stop = mask(m2).grow(0.05, :into => substrate)
# Grow with mask m1, but only where there is a substrate surface
mask(m1).etch(0.3, 0.1, :mode => :round, :into => substrate, :through => stop)
# output the material data to the target layout
output("0/0", substrate)
output("2/0", stop)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.6, 2.1, 0.5))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 9
lp.fill_color = 0x8080ff
lp.frame_color = lp.fill_color
lp.source_layer = 2
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.6, 0)
ant.p2 = RBA::DPoint::new(1.6, -0.3)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.8, -0.3)
ant.p2 = RBA::DPoint::new(1.65, -0.3)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.2)
ant.p2 = RBA::DPoint::new(0.4, -0.4)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.2)
ant.p2 = RBA::DPoint::new(1.3, -0.05)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.15)
ant.p2 = RBA::DPoint::new(0.4, 0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
# -------------------------------------------------------------------
# Doc etch sample 14
sample = "e14"
main_view_index = mw.create_view
main_view = mw.current_view
main_cv = main_view.cellview(main_view.create_layout(false))
main_ly = main_cv.layout
main_top = main_ly.create_cell("TOP")
l1 = main_ly.layer(1, 0)
main_top.shapes(l1).insert(RBA::Box::new(-100, -600, 800, 600))
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(-0.5, 0)
ant.p2 = RBA::DPoint::new(1.5, 0)
ant.style = RBA::Annotation::StyleRuler
main_view.insert_annotation(ant)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
main_view.insert_layer(main_view.end_layers, lp)
main_view.select_cell(main_top.cell_index, 0)
main_view.zoom_fit
configure_view(main_view)
fn = "#{sample}.png"
main_view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
File.open("tmp.xs", "w") do |file|
file.puts(<<END);
delta(0.001)
# Specify wafer thickness
depth(1)
# Prepare input layers
m1 = layer("1/0")
m2 = layer("2/0")
substrate = bulk
# Grow with mask m1 into the substrate
mask(m1).etch(0.3, 0.1, :mode => :round, :into => substrate, :buried => 0.4)
# output the material data to the target layout
output("0/0", substrate)
END
end
XSectionScriptEnvironment.new.run_script("tmp.xs")
File.unlink("tmp.xs")
view = mw.current_view
view.zoom_box(RBA::DBox::new(-0.1, -0.8, 2.1, 0.3))
view.clear_layers
lp = RBA::LayerProperties::new
lp.dither_pattern = 2
lp.fill_color = 0x808080
lp.frame_color = lp.fill_color
lp.source_layer = 0
lp.source_datatype = 0
lp.transparent = true
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 5
lp.fill_color = 0xff8080
lp.frame_color = lp.fill_color
lp.source_layer = 1
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
lp = RBA::LayerProperties::new
lp.dither_pattern = 9
lp.fill_color = 0x8080ff
lp.frame_color = lp.fill_color
lp.source_layer = 2
lp.source_datatype = 0
view.insert_layer(view.end_layers, lp)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.6, 0)
ant.p2 = RBA::DPoint::new(1.6, -0.4)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " $D"
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.25, -0.4)
ant.p2 = RBA::DPoint::new(1.65, -0.4)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(0.4, 0.2)
ant.p2 = RBA::DPoint::new(0.4, -0.5)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.2)
ant.p2 = RBA::DPoint::new(1.3, -0.5)
ant.style = RBA::Annotation::StyleLine
ant.fmt = ""
view.insert_annotation(ant)
ant = RBA::Annotation::new
ant.p1 = RBA::DPoint::new(1.3, 0.15)
ant.p2 = RBA::DPoint::new(0.4, 0.15)
ant.style = RBA::Annotation::StyleArrowBoth
ant.fmt = " MASK: $D"
view.insert_annotation(ant)
fn = "#{sample}_xs.png"
configure_view_xs(view)
view.update_content
view.save_image(fn, screenshot_width, screenshot_height)
puts "Screenshot written to #{fn}"
|
klayout_pyxs/samples/makedoc.rb/0
|
{
"file_path": "klayout_pyxs/samples/makedoc.rb",
"repo_id": "klayout_pyxs",
"token_count": 46778
}
| 121
|
#!/bin/bash -e
#
# Add klayout install folder to path
export PATH=$PATH:"/C/Program Files (x86)/KLayout"
# Check klayout version
echo "Using KLayout:"
klayout_app -v
echo ""
rm -rf run_dir
mkdir -p run_dir
failed=""
# Location of the python macros pyxs.lym (dev version)
bin=../klayout_pyxs/pymacros/pyxs.lym
if [ "$1" == "" ]; then
all_xs=( *.pyxs ) # will test all .pyxs files in the folder
tc_files=${all_xs[@]}
else
tc_files=$* # will test only specified file
fi
for tc_file in $tc_files; do
tc=$(echo "$tc_file" | sed 's/\.pyxs$//')
echo "---------------------------------------------------"
echo "Running testcase $tc .."
# Check which gds file to use
xs_input=$(grep XS_INPUT "$tc".pyxs | sed 's/.*XS_INPUT *= *//')
if [ "$xs_input" = "" ]; then
xs_input="xs_test.gds"
fi
# Check which ruler to use for a cross-section
xs_cut=$(grep XS_CUT "$tc".pyxs | sed 's/.*XS_CUT *= *//')
if [ "$xs_cut" = "" ]; then
xs_cut="-1,0;1,0"
fi
# echo $tc.pyxs
# echo $xs_cut
# echo $tc.gds
# echo $xs_input
# echo $bin
klayout_app -rx -z -rd xs_run="$tc".pyxs -rd xs_cut="$xs_cut" -rd xs_out=run_dir/"$tc".gds "$xs_input" -r $bin
if klayout_app -b -rd a=au/"$tc".gds -rd b=run_dir/"$tc".gds -rd tol=10 -r run_xor.rb; then
echo "No differences found."
else
failed="$failed $tc"
fi
done
echo "---------------------------------------------------"
if [ "$failed" = "" ]; then
echo "All tests successful."
else
echo "*** TESTS FAILED:$failed"
fi
|
klayout_pyxs/tests/run_tests_windows.sh/0
|
{
"file_path": "klayout_pyxs/tests/run_tests_windows.sh",
"repo_id": "klayout_pyxs",
"token_count": 620
}
| 122
|
l1 = layer("1/0")
substrate = bulk()
mask(l1).etch(0.3, 0.1, bias=0.05, mode='octagon', into=substrate)
output("100/0", bulk())
output("101/0", substrate)
|
klayout_pyxs/tests/xs_etch8.pyxs/0
|
{
"file_path": "klayout_pyxs/tests/xs_etch8.pyxs",
"repo_id": "klayout_pyxs",
"token_count": 68
}
| 123
|
l1 = layer("1/0")
m1 = mask(l1).grow(0.3, 0.1, taper=20)
output("100/0", bulk())
output("101/0", m1)
|
klayout_pyxs/tests/xs_grow4.pyxs/0
|
{
"file_path": "klayout_pyxs/tests/xs_grow4.pyxs",
"repo_id": "klayout_pyxs",
"token_count": 54
}
| 124
|
from __future__ import annotations
import hashlib
import pathlib
from copy import deepcopy
from functools import partial
from pathlib import Path
from typing import Any, Optional
import numpy as np
import kfactory as kf
from kgeneric import pdk
from kgeneric.pdk import LayerStack
from kfactory.kcell import clean_value
from kfactory.typings import CellSpec
def get_kwargs_hash(**kwargs: Any) -> str:
"""Returns kwargs parameters hash."""
kwargs_list = [f"{key}={clean_value(kwargs[key])}" for key in sorted(kwargs.keys())]
kwargs_string = "_".join(kwargs_list)
return hashlib.md5(kwargs_string.encode()).hexdigest()[:8]
def _get_sparameters_path(
cell: kf.KCell,
dirpath: Optional[Path] = None,
**kwargs: Any,
) -> Path:
"""Return Sparameters npz filepath hashing simulation settings for \
a consistent unique name.
Args:
component: component or component factory.
dirpath: directory to store sparameters in CSV.
Defaults to active Pdk.sparameters_path.
kwargs: simulation settings.
"""
dirpath_ = dirpath or pdk.sparameters_path
# component = f.get_component(component)
dirpath = pathlib.Path(dirpath_)
dirpath = (
dirpath / cell.function_name
if hasattr(cell, "function_name")
else dirpath
)
dirpath.mkdir(exist_ok=True, parents=True)
return dirpath / f"{cell.hash().hex()}_{get_kwargs_hash(**kwargs)}.npz"
def _get_sparameters_data(
component: ComponentSpec, **kwargs: Any
) -> np.ndarray[str, np.dtype[Any]]:
"""Returns Sparameters data in a pandas DataFrame.
Keyword Args:
component: component.
dirpath: directory path to store sparameters.
kwargs: simulation settings.
"""
component = kf.get_component(component)
kwargs.update(component=component)
filepath = _get_sparameters_path(component=component, **kwargs)
return np.ndarray(np.load(filepath))
get_sparameters_path_meow = partial(_get_sparameters_path, tool="meow")
get_sparameters_path_meep = partial(_get_sparameters_path, tool="meep")
get_sparameters_path_lumerical = partial(_get_sparameters_path, tool="lumerical")
get_sparameters_path_tidy3d = partial(_get_sparameters_path, tool="tidy3d")
get_sparameters_data_meep = partial(_get_sparameters_data, tool="meep")
get_sparameters_data_lumerical = partial(_get_sparameters_data, tool="lumerical")
get_sparameters_data_tidy3d = partial(_get_sparameters_data, tool="tidy3d")
if __name__ == "__main__":
# c = kf.pcells.taper(length=1.0, width1=0.5, width2=0.5, layer=1)
# p = get_sparameters_path_lumerical(c)
# sp = np.load(p)
# spd = dict(sp)
# print(spd)
# test_get_sparameters_path(test=False)
# test_get_sparameters_path(test=True)
print("")
|
kplugins/kplugins/get_sparameters_path.py/0
|
{
"file_path": "kplugins/kplugins/get_sparameters_path.py",
"repo_id": "kplugins",
"token_count": 1102
}
| 125
|
from __future__ import annotations
import re
from functools import partial
from itertools import combinations
from typing import Dict, Optional, Sequence, Tuple
import matplotlib.pyplot as plt
import numpy as np
import kgeneric as kf
def _check_ports(sp: Dict[str, np.ndarray], ports: Sequence[str]):
"""Ensure ports exist in Sparameters."""
for port in ports:
if port not in sp:
raise ValueError(f"Did not find port {port!r} in {list(sp.keys())}")
def plot_sparameters(
sp: Dict[str, np.ndarray],
logscale: bool = True,
keys: Optional[Tuple[str, ...]] = None,
with_simpler_input_keys: bool = False,
with_simpler_labels: bool = True,
) -> None:
"""Plots Sparameters from a dict of np.ndarrays.
Args:
sp: Sparameters np.ndarray.
logscale: plots 20*log10(S).
keys: list of keys to plot, plots all by default.
with_simpler_input_keys: You can use S12 keys instead of o1@0,o2@0.
with_simpler_labels: uses S11, S12 in plot labels instead of o1@0,o2@0.
.. plot::
:include-source:
import gdsfactory as gf
import gdsfactory.simulation as sim
sp = sim.get_sparameters_data_lumerical(component=gf.components.mmi1x2)
sim.plot.plot_sparameters(sp, logscale=True)
"""
w = sp["wavelengths"] * 1e3
keys = keys or [key for key in sp if not key.lower().startswith("wav")]
for key in keys:
if with_simpler_input_keys:
key = f"o{key[1]}@0,o{key[2]}@0"
if key not in sp:
raise ValueError(f"{key!r} not in {list(sp.keys())}")
if with_simpler_labels and "o" in key and "@" in key:
port_mode1_port_mode2 = key.split(",")
if len(port_mode1_port_mode2) != 2:
raise ValueError(f"{key!r} needs to be 'portin@mode,portout@mode'")
port_mode1, port_mode2 = port_mode1_port_mode2
port1, _mode1 = port_mode1.split("@")
port2, _mode2 = port_mode2.split("@")
alias = f"S{port1[1:]}{port2[1:]}"
else:
alias = key
if key not in sp:
raise ValueError(f"{key!r} not in {list(sp.keys())}")
y = sp[key]
y = 20 * np.log10(np.abs(y)) if logscale else np.abs(y) ** 2
plt.plot(w, y, label=alias)
plt.legend()
plt.xlabel("wavelength (nm)")
plt.ylabel("|S| (dB)") if logscale else plt.ylabel("$|S|^2$")
plt.show()
def plot_sparameters_phase(
sp: Dict[str, np.ndarray],
logscale: bool = True,
keys: Optional[Tuple[str, ...]] = None,
with_simpler_input_keys: bool = False,
with_simpler_labels: bool = True,
) -> None:
w = sp["wavelengths"] * 1e3
keys = keys or [key for key in sp if not key.lower().startswith("wav")]
for key in keys:
if with_simpler_input_keys:
key = f"o{key[1]}@0,o{key[2]}@0"
if key not in sp:
raise ValueError(f"{key!r} not in {list(sp.keys())}")
if with_simpler_labels and "o" in key and "@" in key:
port_mode1_port_mode2 = key.split(",")
if len(port_mode1_port_mode2) != 2:
raise ValueError(f"{key!r} needs to be 'portin@mode,portout@mode'")
port_mode1, port_mode2 = port_mode1_port_mode2
port1, _mode1 = port_mode1.split("@")
port2, _mode2 = port_mode2.split("@")
alias = f"S{port1[1:]}{port2[1:]}"
else:
alias = key
if key not in sp:
raise ValueError(f"{key!r} not in {list(sp.keys())}")
y = sp[key]
y = np.angle(y)
plt.plot(w, y, label=alias)
plt.legend()
plt.xlabel("wavelength (nm)")
plt.ylabel("S (deg)")
plt.show()
def plot_imbalance(
sp: Dict[str, np.ndarray], ports: Sequence[str], ax: Optional[plt.Axes] = None
) -> None:
"""Plots imbalance in dB for coupler.
The imbalance is always defined between two ports, so this function plots the
imbalance between all unique port combinations.
Args:
sp: sparameters dict np.ndarray.
ports: list of port name @ mode index. o1@0 is the fundamental mode for o1 port.
ax: matplotlib axis object to draw into.
"""
_check_ports(sp, ports)
power = {port: np.abs(sp[port]) ** 2 for port in ports}
x = sp["wavelengths"] * 1e3
if ax is None:
_, ax = plt.subplots()
for p1, p2 in combinations(ports, 2):
p1in, p1out = re.findall(r"\d+", p1)[::2]
p2in, p2out = re.findall(r"\d+", p2)[::2]
label = f"$S_{{{p1in}{p1out}}}, S_{{{p2in}{p2out}}}$"
ax.plot(x, 10 * np.log10(1 - (power[p1] - power[p2])), label=label)
ax.set_xlim((x[0], x[-1]))
ax.set_xlabel("wavelength (nm)")
ax.set_ylabel("imbalance (dB)")
plt.legend()
def plot_loss(
sp: Dict[str, np.ndarray], ports: Sequence[str], ax: Optional[plt.Axes] = None
) -> None:
"""Plots loss dB for coupler.
Args:
sp: sparameters dict np.ndarray.
ports: list of port name @ mode index. o1@0 is the fundamental mode for o1 port.
ax: matplotlib axis object to draw into.
"""
_check_ports(sp, ports)
power = {port: np.abs(sp[port]) ** 2 for port in ports}
x = sp["wavelengths"] * 1e3
if ax is None:
_, ax = plt.subplots()
for n, p in power.items():
pin, pout = re.findall(r"\d+", n)[::2]
ax.plot(x, 10 * np.log10(p), label=f"$|S_{{{pin}{pout}}}|^2$")
if len(ports) > 1:
ax.plot(x, 10 * np.log10(sum(power.values())), "k--", label="Total")
ax.set_xlim((x[0], x[-1]))
ax.set_xlabel("wavelength (nm)")
ax.set_ylabel("excess loss (dB)")
plt.legend()
def plot_reflection(
sp: Dict[str, np.ndarray], ports: Sequence[str], ax: Optional[plt.Axes] = None
) -> None:
"""Plots reflection in dB for coupler.
Args:
sp: sparameters dict np.ndarray.
ports: list of port name @ mode index. o1@0 is the fundamental mode for o1 port.
ax: matplotlib axis object to draw into.
"""
_check_ports(sp, ports)
power = {port: np.abs(sp[port]) ** 2 for port in ports}
x = sp["wavelengths"] * 1e3
if ax is None:
_, ax = plt.subplots()
for n, p in power.items():
pin, pout = re.findall(r"\d+", n)[::2]
ax.plot(x, 10 * np.log10(p), label=f"$|S_{{{pin}{pout}}}|^2$")
if len(ports) > 1:
ax.plot(x, 10 * np.log10(sum(power.values())), "k--", label="Total")
ax.set_xlim((x[0], x[-1]))
ax.set_xlabel("wavelength (nm)")
ax.set_ylabel("reflection (dB)")
plt.legend()
plot_loss1x2 = partial(plot_loss, ports=["o1@0,o2@0", "o1@0,o3@0"])
plot_loss2x2 = partial(plot_loss, ports=["o1@0,o3@0", "o1@0,o4@0"])
plot_imbalance1x2 = partial(plot_imbalance, ports=["o1@0,o2@0", "o1@0,o3@0"])
plot_imbalance2x2 = partial(plot_imbalance, ports=["o1@0,o3@0", "o1@0,o4@0"])
plot_reflection1x2 = partial(plot_reflection, ports=["o1@0,o1@0"])
plot_reflection2x2 = partial(plot_reflection, ports=["o1@0,o1@0", "o2@0,o1@0"])
if __name__ == "__main__":
import gdsfactory.simulation as sim
sp = sim.get_sparameters_data_tidy3d(component=kf.cells.mmi1x2)
# plot_sparameters(sp, logscale=False, keys=["o1@0,o2@0"])
# plot_sparameters(sp, logscale=False, keys=["S21"])
# plt.show()
|
kplugins/kplugins/plot.py/0
|
{
"file_path": "kplugins/kplugins/plot.py",
"repo_id": "kplugins",
"token_count": 3500
}
| 126
|
project = "kweb"
version = "0.1.1"
copyright = "2022"
# copyright = "2020, gdsfactory"
# author = "gdsfactory"
# html_theme = "furo"
# html_theme = "sphinx_rtd_theme"
html_theme = "sphinx_book_theme"
source_suffix = {
".rst": "restructuredtext",
".txt": "markdown",
".md": "markdown",
}
html_static_path = ["_static"]
extensions = [
"matplotlib.sphinxext.plot_directive",
"myst_parser",
"nbsphinx",
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx_autodoc_typehints",
"sphinx_click",
"sphinx_markdown_tables",
"sphinx_copybutton",
"sphinxcontrib.autodoc_pydantic",
"sphinx.ext.autosummary",
"sphinx.ext.extlinks",
]
autodoc_member_order = "bysource"
templates_path = ["_templates"]
exclude_patterns = [
"_build",
"Thumbs.db",
".DS_Store",
"**.ipynb_checkpoints",
"build",
"extra",
]
napoleon_use_param = True
language = "en"
myst_html_meta = {
"description lang=en": "metadata description",
"description lang=fr": "description des métadonnées",
"keywords": "Sphinx, MyST",
"property=og:locale": "en_US",
}
html_theme_options = {
"path_to_docs": "docs",
"repository_url": "https://github.com/gdsfactory/gdsfactory",
"repository_branch": "master",
"launch_buttons": {
"binderhub_url": "https://mybinder.org/v2/gh/gdsfactory/gdsfactory/HEAD",
"notebook_interface": "jupyterlab",
},
"use_edit_page_button": True,
"use_issues_button": True,
"use_repository_button": True,
"use_download_button": True,
}
autodoc_pydantic_model_signature_prefix = "class"
autodoc_pydantic_field_signature_prefix = "attribute"
autodoc_pydantic_model_show_config_member = False
autodoc_pydantic_model_show_config_summary = False
autodoc_pydantic_model_show_validator_summary = False
autodoc_pydantic_model_show_validator_members = False
autodoc_default_options = {
"member-order": "bysource",
"special-members": "__init__",
"undoc-members": True,
"exclude-members": "__weakref__",
"inherited-members": True,
"show-inheritance": True,
}
|
kweb/docs/conf.py/0
|
{
"file_path": "kweb/docs/conf.py",
"repo_id": "kweb",
"token_count": 981
}
| 127
|
from math import ceil
import gdsfactory as gf
from gdsfactory.typings import Float2, LayerSpec
@gf.cell
def via_generator(
width: float = 1,
length: float = 1,
via_size: Float2 = (0.17, 0.17),
via_layer: LayerSpec = (66, 44),
via_enclosure: Float2 = (0.06, 0.06),
via_spacing: Float2 = (0.17, 0.17),
) -> gf.Component:
"""Return vias within the area of width x length \
and set number of rows and number of columns as a \
global variable to be used outside the function.
.. plot::
:include-source:
import sky130
c = sky130.pcells.via_generator()
c.plot()
"""
c = gf.Component()
nr = ceil(length / (via_size[1] + via_spacing[1]))
nc = ceil(width / (via_size[0] + via_spacing[0]))
if (length - nr * via_size[1] - (nr - 1) * via_spacing[1]) / 2 < via_enclosure[1]:
nr -= 1
nr = max(nr, 1)
if (width - nc * via_size[0] - (nc - 1) * via_spacing[0]) / 2 < via_enclosure[0]:
nc -= 1
nc = max(nc, 1)
via_sp = (via_size[0] + via_spacing[0], via_size[1] + via_spacing[1])
rect_via = gf.components.rectangle(size=via_size, layer=via_layer)
c.add_array(rect_via, rows=nr, columns=nc, spacing=via_sp)
return c
def demo_via():
width = 1.5
length = 1.5
via_size = (
0.17,
0.17,
) # via4:(0.8,0.8),via3,via2 : (0.2,0.2) ,via1 : (0.15,0.15),licon: (0.17,0.17)
via_spacing = (
0.17,
0.17,
) # via4:(0.8,0.8) via2 :(0.2,0.2), via1,licon :(0.17,0.17)
via_layer = (
66,
44,
) # via4:(71,44),via3 :(70,44)via2 : (69,44) ,via1 : (68,44),licon: (66,44)
via_enclosure = (
0.06,
0.06,
) # via4: (0.19,0.19)via2 : (0.04,0.04) via1 : (0.055,0.055),via3,licon: (0.06,0.06)
bottom_layer: LayerSpec = (
65,
44,
) # m4 :(71,20),m3:(70:20) , m2 :(69,20), m1 :(68,20),tap: (65,44)
rect = gf.components.rectangle(size=(width, length), layer=bottom_layer)
nr = ceil(length / (via_size[1] + via_spacing[1]))
nc = ceil(width / (via_size[0] + via_spacing[0]))
c1 = gf.Component("via test for rectangle")
c1.add_label(
f"test for via4 over met4 within {width} x {length} area",
position=(width / 2, length + via_enclosure[1]),
)
c1.add_ref(rect)
c = via_generator(
width=width,
length=length,
via_size=via_size,
via_spacing=via_spacing,
via_layer=via_layer,
)
v = c1.add_ref(c)
v.move(
(
(width - nc * via_size[0] - (nc - 1) * via_spacing[0]) / 2,
(length - nr * via_size[1] - (nr - 1) * via_spacing[1]) / 2,
)
)
c2 = gf.Component("via test for bending structure")
rect_out = gf.components.rectangle(size=(4 * width, 4 * length))
d = gf.Component()
x1 = d.add_ref(rect)
x2 = d.add_ref(rect_out)
x1.move((1.5 * width, 1.5 * length))
c2.add_ref(gf.geometry.boolean(A=x2, B=x1, operation="A-B", layer=bottom_layer))
c2.add_label(
"test for via4 over met4 within a bending area",
position=(width, 4 * length + via_enclosure[1]),
)
for i in range(2):
v = via_generator(
width=x2.xmax - x1.xmax,
length=x1.ymax - x1.ymin,
via_enclosure=via_enclosure,
via_size=via_size,
via_spacing=via_spacing,
via_layer=via_layer,
)
vi = c2.add_ref(v)
vi.movex(
(x2.xmax - x1.xmax - nc * via_size[0] - (nc - 1) * via_spacing[0]) / 2
+ i * (x2.xmax - x1.xmin)
)
vi.movey(
x1.ymin
- x2.ymin
+ (x1.ymax - x1.ymin - nr * via_size[1] - (nr - 1) * via_spacing[1]) / 2
)
for i in range(2):
h = via_generator(
width=x1.xmax - x1.xmin,
length=x2.ymax - x1.ymax,
via_enclosure=via_enclosure,
via_size=via_size,
via_spacing=via_spacing,
via_layer=via_layer,
)
vi = c2.add_ref(h)
vi.movey(
(x2.ymax - x1.ymax - nr * via_size[1] - (nr - 1) * via_spacing[1]) / 2
+ i * (x2.ymax - x1.ymin)
)
vi.movex(
x1.xmin
- x2.xmin
+ (x1.xmax - x1.xmin - nc * via_size[0] - (nc - 1) * via_spacing[0]) / 2
)
for i in range(2):
for j in range(2):
cor = via_generator(
width=x2.xmax - x1.xmax,
length=x2.ymax - x1.ymax,
via_enclosure=via_enclosure,
via_size=via_size,
via_spacing=via_spacing,
via_layer=via_layer,
)
co = c2.add_ref(cor)
co.movex(
(x2.xmax - x1.xmax - nc * via_size[0] - (nc - 1) * via_spacing[0]) / 2
)
co.movey(
(x1.ymin - x2.ymin - nr * via_size[1] - (nr - 1) * via_spacing[1]) / 2
)
co.movex(j * (x2.xmax - x1.xmin))
co.movey(i * (x2.ymax - x1.ymin))
return c2
if __name__ == "__main__":
# c = via_generator()
c = demo_via()
c.show(show_ports=True)
|
skywater130/sky130/pcells/via_generator.py/0
|
{
"file_path": "skywater130/sky130/pcells/via_generator.py",
"repo_id": "skywater130",
"token_count": 2924
}
| 128
|
function: pmos_5v
info: {}
module: sky130.pcells.pmos_5v
name: pmos_5v
settings:
contact_enclosure:
- 0.06
- 0.06
contact_layer:
- 66
- 44
contact_size:
- 0.17
- 0.17
contact_spacing:
- 0.17
- 0.17
diff_enclosure:
- 0.33
- 0.33
diff_spacing: 0.37
diffn_layer:
- 65
- 44
diffusion_layer:
- 65
- 20
dnwell_enclosure:
- 0.4
- 0.4
dnwell_layer:
- 64
- 18
end_cap: 0.13
gate_length: 0.5
gate_width: 0.75
hvi_layer:
- 75
- 20
li_enclosure: 0.08
li_layer:
- 67
- 20
li_spacing: 0.17
li_width: 0.17
m1_layer:
- 68
- 20
mcon_enclosure:
- 0.03
- 0.06
mcon_layer:
- 67
- 44
nf: 1
npc_layer:
- 95
- 20
npc_spacing: 0.09
nsdm_layer:
- 93
- 44
nwell_layer:
- 64
- 22
poly_layer:
- 66
- 20
psdm_layer:
- 94
- 20
sd_width: 0.3
sdm_enclosure:
- 0.125
- 0.125
sdm_spacing: 0.13
|
skywater130/tests/test_components/test_pdk_settings_pmos_5v_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_pmos_5v_.yml",
"repo_id": "skywater130",
"token_count": 470
}
| 129
|
function: sky130_fd_sc_hd__a21bo_2
info: {}
module: sky130.components
name: sky130_fd_sc_hd__a21bo_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__a21bo_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__a21bo_2_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 130
|
function: sky130_fd_sc_hd__a221oi_2
info: {}
module: sky130.components
name: sky130_fd_sc_hd__a221oi_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__a221oi_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__a221oi_2_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 131
|
function: sky130_fd_sc_hd__a311o_2
info: {}
module: sky130.components
name: sky130_fd_sc_hd__a311o_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__a311o_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__a311o_2_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 132
|
function: sky130_fd_sc_hd__a32oi_4
info: {}
module: sky130.components
name: sky130_fd_sc_hd__a32oi_4
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__a32oi_4_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__a32oi_4_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 133
|
function: sky130_fd_sc_hd__and3_4
info: {}
module: sky130.components
name: sky130_fd_sc_hd__and3_4
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__and3_4_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__and3_4_.yml",
"repo_id": "skywater130",
"token_count": 48
}
| 134
|
function: sky130_fd_sc_hd__buf_2
info: {}
module: sky130.components
name: sky130_fd_sc_hd__buf_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__buf_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__buf_2_.yml",
"repo_id": "skywater130",
"token_count": 46
}
| 135
|
function: sky130_fd_sc_hd__clkdlybuf4s18_2
info: {}
module: sky130.components
name: sky130_fd_sc_hd__clkdlybuf4s18_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__clkdlybuf4s18_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__clkdlybuf4s18_2_.yml",
"repo_id": "skywater130",
"token_count": 60
}
| 136
|
function: sky130_fd_sc_hd__decap_6
info: {}
module: sky130.components
name: sky130_fd_sc_hd__decap_6
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__decap_6_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__decap_6_.yml",
"repo_id": "skywater130",
"token_count": 48
}
| 137
|
function: sky130_fd_sc_hd__dfxbp_1
info: {}
module: sky130.components
name: sky130_fd_sc_hd__dfxbp_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__dfxbp_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__dfxbp_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 138
|
function: sky130_fd_sc_hd__dlrtp_1
info: {}
module: sky130.components
name: sky130_fd_sc_hd__dlrtp_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__dlrtp_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__dlrtp_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 139
|
function: sky130_fd_sc_hd__ebufn_1
info: {}
module: sky130.components
name: sky130_fd_sc_hd__ebufn_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__ebufn_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__ebufn_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 140
|
function: sky130_fd_sc_hd__fa_2
info: {}
module: sky130.components
name: sky130_fd_sc_hd__fa_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__fa_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__fa_2_.yml",
"repo_id": "skywater130",
"token_count": 46
}
| 141
|
function: sky130_fd_sc_hd__inv_4
info: {}
module: sky130.components
name: sky130_fd_sc_hd__inv_4
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__inv_4_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__inv_4_.yml",
"repo_id": "skywater130",
"token_count": 46
}
| 142
|
function: sky130_fd_sc_hd__lpflow_decapkapwr_4
info: {}
module: sky130.components
name: sky130_fd_sc_hd__lpflow_decapkapwr_4
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__lpflow_decapkapwr_4_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__lpflow_decapkapwr_4_.yml",
"repo_id": "skywater130",
"token_count": 60
}
| 143
|
function: sky130_fd_sc_hd__lpflow_lsbuf_lh_hl_isowell_tap_4
info: {}
module: sky130.components
name: sky130_fd_sc_hd__lpflow_lsbuf_lh_hl_isowell_tap_4
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__lpflow_lsbuf_lh_hl_isowell_tap_4_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__lpflow_lsbuf_lh_hl_isowell_tap_4_.yml",
"repo_id": "skywater130",
"token_count": 74
}
| 144
|
function: sky130_fd_sc_hd__mux4_2
info: {}
module: sky130.components
name: sky130_fd_sc_hd__mux4_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__mux4_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__mux4_2_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 145
|
function: sky130_fd_sc_hd__nand4_2
info: {}
module: sky130.components
name: sky130_fd_sc_hd__nand4_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__nand4_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__nand4_2_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 146
|
function: sky130_fd_sc_hd__nor3_2
info: {}
module: sky130.components
name: sky130_fd_sc_hd__nor3_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__nor3_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__nor3_2_.yml",
"repo_id": "skywater130",
"token_count": 48
}
| 147
|
function: sky130_fd_sc_hd__o2111a_4
info: {}
module: sky130.components
name: sky130_fd_sc_hd__o2111a_4
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__o2111a_4_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__o2111a_4_.yml",
"repo_id": "skywater130",
"token_count": 52
}
| 148
|
function: sky130_fd_sc_hd__o21ai_4
info: {}
module: sky130.components
name: sky130_fd_sc_hd__o21ai_4
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__o21ai_4_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__o21ai_4_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 149
|
function: sky130_fd_sc_hd__o22ai_1
info: {}
module: sky130.components
name: sky130_fd_sc_hd__o22ai_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__o22ai_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__o22ai_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 150
|
function: sky130_fd_sc_hd__o31a_1
info: {}
module: sky130.components
name: sky130_fd_sc_hd__o31a_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__o31a_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__o31a_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 151
|
function: sky130_fd_sc_hd__o41ai_2
info: {}
module: sky130.components
name: sky130_fd_sc_hd__o41ai_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__o41ai_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__o41ai_2_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 152
|
function: sky130_fd_sc_hd__or4_2
info: {}
module: sky130.components
name: sky130_fd_sc_hd__or4_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__or4_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__or4_2_.yml",
"repo_id": "skywater130",
"token_count": 48
}
| 153
|
function: sky130_fd_sc_hd__sdfrtp_1
info: {}
module: sky130.components
name: sky130_fd_sc_hd__sdfrtp_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__sdfrtp_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__sdfrtp_1_.yml",
"repo_id": "skywater130",
"token_count": 52
}
| 154
|
function: sky130_fd_sc_hd__sedfxbp_1
info: {}
module: sky130.components
name: sky130_fd_sc_hd__sedfxbp_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__sedfxbp_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__sedfxbp_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 155
|
function: sky130_fd_sc_hd__xor2_1
info: {}
module: sky130.components
name: sky130_fd_sc_hd__xor2_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__xor2_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hd__xor2_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 156
|
function: sky130_fd_sc_hs__a211oi_2
info: {}
module: sky130.components
name: sky130_fd_sc_hs__a211oi_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__a211oi_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__a211oi_2_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 157
|
function: sky130_fd_sc_hs__a221o_4
info: {}
module: sky130.components
name: sky130_fd_sc_hs__a221o_4
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__a221o_4_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__a221o_4_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 158
|
function: sky130_fd_sc_hs__a2bb2o_4
info: {}
module: sky130.components
name: sky130_fd_sc_hs__a2bb2o_4
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__a2bb2o_4_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__a2bb2o_4_.yml",
"repo_id": "skywater130",
"token_count": 54
}
| 159
|
function: sky130_fd_sc_hs__a32o_1
info: {}
module: sky130.components
name: sky130_fd_sc_hs__a32o_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__a32o_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__a32o_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 160
|
function: sky130_fd_sc_hs__and2b_2
info: {}
module: sky130.components
name: sky130_fd_sc_hs__and2b_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__and2b_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__and2b_2_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 161
|
function: sky130_fd_sc_hs__and4bb_4
info: {}
module: sky130.components
name: sky130_fd_sc_hs__and4bb_4
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__and4bb_4_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__and4bb_4_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 162
|
function: sky130_fd_sc_hs__clkdlyinv3sd2_1
info: {}
module: sky130.components
name: sky130_fd_sc_hs__clkdlyinv3sd2_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__clkdlyinv3sd2_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__clkdlyinv3sd2_1_.yml",
"repo_id": "skywater130",
"token_count": 60
}
| 163
|
function: sky130_fd_sc_hs__dfrbp_1
info: {}
module: sky130.components
name: sky130_fd_sc_hs__dfrbp_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__dfrbp_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__dfrbp_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 164
|
function: sky130_fd_sc_hs__diode_2
info: {}
module: sky130.components
name: sky130_fd_sc_hs__diode_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__diode_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__diode_2_.yml",
"repo_id": "skywater130",
"token_count": 48
}
| 165
|
function: sky130_fd_sc_hs__dlxbp_1
info: {}
module: sky130.components
name: sky130_fd_sc_hs__dlxbp_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__dlxbp_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__dlxbp_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 166
|
function: sky130_fd_sc_hs__edfxtp_1
info: {}
module: sky130.components
name: sky130_fd_sc_hs__edfxtp_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__edfxtp_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__edfxtp_1_.yml",
"repo_id": "skywater130",
"token_count": 52
}
| 167
|
function: sky130_fd_sc_hs__fahcon_1
info: {}
module: sky130.components
name: sky130_fd_sc_hs__fahcon_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__fahcon_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__fahcon_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 168
|
function: sky130_fd_sc_hs__maj3_1
info: {}
module: sky130.components
name: sky130_fd_sc_hs__maj3_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__maj3_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__maj3_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 169
|
function: sky130_fd_sc_hs__nand2b_1
info: {}
module: sky130.components
name: sky130_fd_sc_hs__nand2b_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__nand2b_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__nand2b_1_.yml",
"repo_id": "skywater130",
"token_count": 52
}
| 170
|
function: sky130_fd_sc_hs__nand4bb_2
info: {}
module: sky130.components
name: sky130_fd_sc_hs__nand4bb_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__nand4bb_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__nand4bb_2_.yml",
"repo_id": "skywater130",
"token_count": 52
}
| 171
|
function: sky130_fd_sc_hs__nor4_2
info: {}
module: sky130.components
name: sky130_fd_sc_hs__nor4_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__nor4_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__nor4_2_.yml",
"repo_id": "skywater130",
"token_count": 48
}
| 172
|
function: sky130_fd_sc_hs__o211a_4
info: {}
module: sky130.components
name: sky130_fd_sc_hs__o211a_4
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__o211a_4_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__o211a_4_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 173
|
function: sky130_fd_sc_hs__o221a_1
info: {}
module: sky130.components
name: sky130_fd_sc_hs__o221a_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__o221a_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__o221a_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 174
|
function: sky130_fd_sc_hs__o2bb2ai_2
info: {}
module: sky130.components
name: sky130_fd_sc_hs__o2bb2ai_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__o2bb2ai_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__o2bb2ai_2_.yml",
"repo_id": "skywater130",
"token_count": 54
}
| 175
|
function: sky130_fd_sc_hs__o32a_4
info: {}
module: sky130.components
name: sky130_fd_sc_hs__o32a_4
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__o32a_4_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__o32a_4_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 176
|
function: sky130_fd_sc_hs__or3_1
info: {}
module: sky130.components
name: sky130_fd_sc_hs__or3_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__or3_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__or3_1_.yml",
"repo_id": "skywater130",
"token_count": 48
}
| 177
|
function: sky130_fd_sc_hs__sdfbbn_2
info: {}
module: sky130.components
name: sky130_fd_sc_hs__sdfbbn_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__sdfbbn_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__sdfbbn_2_.yml",
"repo_id": "skywater130",
"token_count": 52
}
| 178
|
function: sky130_fd_sc_hs__sdfxtp_2
info: {}
module: sky130.components
name: sky130_fd_sc_hs__sdfxtp_2
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__sdfxtp_2_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__sdfxtp_2_.yml",
"repo_id": "skywater130",
"token_count": 52
}
| 179
|
function: sky130_fd_sc_hs__xnor2_1
info: {}
module: sky130.components
name: sky130_fd_sc_hs__xnor2_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__xnor2_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hs__xnor2_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 180
|
function: sky130_fd_sc_hvl__and2_1
info: {}
module: sky130.components
name: sky130_fd_sc_hvl__and2_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hvl__and2_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hvl__and2_1_.yml",
"repo_id": "skywater130",
"token_count": 50
}
| 181
|
function: sky130_fd_sc_hvl__dfxtp_1
info: {}
module: sky130.components
name: sky130_fd_sc_hvl__dfxtp_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hvl__dfxtp_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hvl__dfxtp_1_.yml",
"repo_id": "skywater130",
"token_count": 52
}
| 182
|
function: sky130_fd_sc_hvl__lsbufhv2hv_hl_1
info: {}
module: sky130.components
name: sky130_fd_sc_hvl__lsbufhv2hv_hl_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hvl__lsbufhv2hv_hl_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hvl__lsbufhv2hv_hl_1_.yml",
"repo_id": "skywater130",
"token_count": 64
}
| 183
|
function: sky130_fd_sc_hvl__o22a_1
info: {}
module: sky130.components
name: sky130_fd_sc_hvl__o22a_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hvl__o22a_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hvl__o22a_1_.yml",
"repo_id": "skywater130",
"token_count": 52
}
| 184
|
function: sky130_fd_sc_hvl__xor2_1
info: {}
module: sky130.components
name: sky130_fd_sc_hvl__xor2_1
settings: {}
|
skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hvl__xor2_1_.yml/0
|
{
"file_path": "skywater130/tests/test_components/test_pdk_settings_sky130_fd_sc_hvl__xor2_1_.yml",
"repo_id": "skywater130",
"token_count": 52
}
| 185
|
# Table of contents
# Learn more at https://jterbook.org/customize/toc.html
format: jb-book
root: index
parts:
- caption: Introduction
chapters:
- file: tech
- file: components
- file: components_plot
- file: layout
sections:
- file: notebooks/00_layout
- file: notebooks/21_schematic_driven_layout
- file: simulations
sections:
- file: notebooks/11_sparameters
- file: notebooks/11_sparameters_gratings
- file: notebooks/12_sim_plugins_tidy3d
- file: notebooks/13_sim_plugins
- file: notebooks/14_sax_tidy3d
- file: data_analysis
sections:
- file: notebooks/31_data_analysis_mzi
- file: notebooks/32_data_analysis_ring
- file: notebooks/33_data_analysis_dbr
- caption: Reference
chapters:
- file: changelog
- url: https://gdsfactory.github.io/gplugins/
title: Plugins
- url: https://gdsfactory.github.io/gdsfactory
title: gdsfactory
- url: https://gdsfactory.github.io/gdsfactory-photonics-training/
title: gdsfactory-photonics-training
|
ubc/docs/_toc.yml/0
|
{
"file_path": "ubc/docs/_toc.yml",
"repo_id": "ubc",
"token_count": 515
}
| 186
|
schema_version: 1
schema: null
instances:
mmi1:
component: mmi1x2
settings: {gap_mmi: 1.0}
mmi2:
component: mmi2x2
settings: {gap_mmi: 0.7}
s1:
component: straight
settings: {length: 20, npoints: 2, layer: null, width: null, add_pins: true, cross_section: xs_sc,
add_bbox: null, post_process: null}
s2:
component: straight
settings: {length: 40, npoints: 2, layer: null, width: null, add_pins: true, cross_section: xs_sc,
add_bbox: null, post_process: null}
placements:
mmi1: {x: null, y: null, port: null, rotation: 0.0, dx: -22.832156230736544, dy: -0.9358105716724547,
mirror: null}
mmi2: {x: null, y: null, port: null, rotation: 0.0, dx: 130.94675850281985, dy: -0.39903161225107286,
mirror: null}
s1: {x: null, y: null, port: null, rotation: 0.0, dx: 55.26042176045793, dy: 32.1189871057287,
mirror: null}
s2: {x: null, y: null, port: null, rotation: 0.0, dx: 44.25454877902524, dy: -45.88086750118762,
mirror: null}
routes:
r0:
routing_strategy: get_bundle
settings: {cross_section: xs_sc, separation: 5.0}
links: {'mmi1,o2': 's1,o1'}
r1:
routing_strategy: get_bundle
settings: {cross_section: xs_sc, separation: 5.0}
links: {'mmi2,o2': 's1,o2'}
r2:
routing_strategy: get_bundle
settings: {cross_section: xs_sc, separation: 5.0}
links: {'mmi1,o3': 's2,o1'}
r3:
routing_strategy: get_bundle
settings: {cross_section: xs_sc, separation: 5.0}
links: {'mmi2,o1': 's2,o2'}
ports: {o1: 'mmi1,o1', o2: 'mmi2,o3', o3: 'mmi2,o4'}
|
ubc/docs/notebooks/sdl_demo.pic.yml/0
|
{
"file_path": "ubc/docs/notebooks/sdl_demo.pic.yml",
"repo_id": "ubc",
"token_count": 746
}
| 187
|
resolution: 20
port_symmetries: {}
wavelength_start: 1.5
wavelength_stop: 1.6
wavelength_points: 50
port_margin: 2
port_monitor_offset: -0.1
port_source_offset: -0.1
dispersive: false
ymargin_top: 3
ymargin_bot: 3
xmargin_left: 0
xmargin_right: 0
is_3d: false
material_name_to_meep:
si: 2.8494636999424405
layer_stack:
strip:
layer:
- 1
- 0
thickness: 0.22
zmin: 0.0
material: si
sidewall_angle: 0
info: {}
strip2:
layer:
- 31
- 0
thickness: 0.22
zmin: 0.0
material: si
sidewall_angle: 0
info: {}
component:
name: ebeam_y_1550
settings:
name: ebeam_y_1550
module: ubcpdk.components
function_name: ebeam_y_1550
info:
library: Design kits/ebeam
model: ebeam_y_1550
info_version: 2
full: {}
changed: {}
default: {}
child: null
compute_time_seconds: 99.67435359954834
compute_time_minutes: 1.661239226659139
|
ubc/sparameters/ebeam_y_1550_76acf988.yml/0
|
{
"file_path": "ubc/sparameters/ebeam_y_1550_76acf988.yml",
"repo_id": "ubc",
"token_count": 432
}
| 188
|
compute_time_minutes: 0.013
compute_time_seconds: 0.788
fiber_angle_deg: -31
fiber_xoffset: 0
is_3d: false
|
ubc/sparameters/gc_-31.0deg_0.0um.yml/0
|
{
"file_path": "ubc/sparameters/gc_-31.0deg_0.0um.yml",
"repo_id": "ubc",
"token_count": 49
}
| 189
|
is_3d: false
fiber_angle_deg: -31
fiber_xoffset: -10
compute_time_seconds: 65.07130861282349
compute_time_minutes: 1.0845218102137248
|
ubc/sparameters/mirror_948d7eaf_gc_te1550_985757a9.yml/0
|
{
"file_path": "ubc/sparameters/mirror_948d7eaf_gc_te1550_985757a9.yml",
"repo_id": "ubc",
"token_count": 59
}
| 190
|
function: add_fiber_array_pads_rf
info: {}
module: ubcpdk.components
name: add_fiber_array_pads_rf
settings:
component: ring_single_heater
orientation: 0
username: JoaquinMatres
|
ubc/tests/test_components/test_pdk_settings_add_fiber_array_pads_rf_.yml/0
|
{
"file_path": "ubc/tests/test_components/test_pdk_settings_add_fiber_array_pads_rf_.yml",
"repo_id": "ubc",
"token_count": 67
}
| 191
|
function: dbr_cavity
info: {}
module: ubcpdk.components
name: dbr_cavity
settings:
coupler:
function: coupler
dbr:
function: dbr
|
ubc/tests/test_components/test_pdk_settings_dbr_cavity_.yml/0
|
{
"file_path": "ubc/tests/test_components/test_pdk_settings_dbr_cavity_.yml",
"repo_id": "ubc",
"token_count": 60
}
| 192
|
name: ebeam_gc_te1310_broadband
settings:
changed: {}
child: null
default: {}
full: {}
function_name: ebeam_gc_te1310_broadband
info:
library: Design kits/ebeam
model: ebeam_gc_te1310_broadband
polarization: te
wavelength: 1.31
info_version: 2
module: ubcpdk.components
name: ebeam_gc_te1310_broadband
|
ubc/tests/test_components/test_pdk_settings_ebeam_gc_te1310_broadband_.yml/0
|
{
"file_path": "ubc/tests/test_components/test_pdk_settings_ebeam_gc_te1310_broadband_.yml",
"repo_id": "ubc",
"token_count": 134
}
| 193
|
function: gc_te1310
info:
library: Design kits/ebeam
model: ebeam_gc_te1310
polarization: te
wavelength: 1.31
module: ubcpdk.components
name: gc_te1310
settings: {}
|
ubc/tests/test_components/test_pdk_settings_gc_te1310_.yml/0
|
{
"file_path": "ubc/tests/test_components/test_pdk_settings_gc_te1310_.yml",
"repo_id": "ubc",
"token_count": 67
}
| 194
|
function: ring_double
info: {}
module: gdsfactory.components.ring_double
name: ring_double_a459ac5d
settings:
bend:
function: bend_euler
coupler_ring:
function: coupler_ring
cross_section:
bbox_layers: null
bbox_offsets: null
components_along_path: []
radius: 10.0
radius_min: 5.0
sections:
- hidden: false
insets: null
layer: WG
name: _default
offset: 0.0
offset_function: null
port_names:
- o1
- o2
port_types:
- optical
- optical
simplify: null
width: 0.5
width_function: null
gap: 0.2
gap_top: null
length_x: 0.01
length_y: 0.01
radius: 10.0
straight:
function: straight
|
ubc/tests/test_components/test_pdk_settings_ring_double_.yml/0
|
{
"file_path": "ubc/tests/test_components/test_pdk_settings_ring_double_.yml",
"repo_id": "ubc",
"token_count": 330
}
| 195
|
function: via_stack
info:
layer:
- 12
- 0
size:
- 10
- 10
xsize: 10
ysize: 10
module: gdsfactory.components.via_stack
name: via_stack_627f28a4
settings:
correct_size: true
layer_offsets: null
layer_port: null
layers:
- - 11
- 0
- - 12
- 0
size:
- 10
- 10
slot_horizontal: false
slot_vertical: false
vias:
- null
- null
|
ubc/tests/test_components/test_pdk_settings_via_stack_heater_mtop_.yml/0
|
{
"file_path": "ubc/tests/test_components/test_pdk_settings_via_stack_heater_mtop_.yml",
"repo_id": "ubc",
"token_count": 163
}
| 196
|
connections: {}
instances:
BondPad$1_1:
component: BondPad$1
info: {}
settings: {}
name: ebeam_BondPad
placements:
BondPad$1_1:
mirror: 0
rotation: 180
x: 50.0
y: 50.0
ports: {}
|
ubc/tests/test_netlists/test_netlists_ebeam_BondPad_.yml/0
|
{
"file_path": "ubc/tests/test_netlists/test_netlists_ebeam_BondPad_.yml",
"repo_id": "ubc",
"token_count": 100
}
| 197
|
connections: {}
instances: {}
name: ebeam_y_1550
placements: {}
ports: {}
|
ubc/tests/test_netlists/test_netlists_ebeam_y_1550_.yml/0
|
{
"file_path": "ubc/tests/test_netlists/test_netlists_ebeam_y_1550_.yml",
"repo_id": "ubc",
"token_count": 29
}
| 198
|
connections: {}
instances: {}
name: photonic_wirebond_surfacetaper_1310
placements: {}
ports: {}
|
ubc/tests/test_netlists/test_netlists_photonic_wirebond_surfacetaper_1310_.yml/0
|
{
"file_path": "ubc/tests/test_netlists/test_netlists_photonic_wirebond_surfacetaper_1310_.yml",
"repo_id": "ubc",
"token_count": 36
}
| 199
|
connections: {}
instances: {}
name: thermal_phase_shifter3
placements: {}
ports: {}
|
ubc/tests/test_netlists/test_netlists_thermal_phase_shifter3_.yml/0
|
{
"file_path": "ubc/tests/test_netlists/test_netlists_thermal_phase_shifter3_.yml",
"repo_id": "ubc",
"token_count": 29
}
| 200
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.