kqcircuits.simulations.layered_simulation

class kqcircuits.simulations.layered_simulation.LayeredSimulation(layout, cell=None, **kwargs)[source]

Bases: AbstractSimulation

Base class for layered 2.5 dimensional simulation models.

This class is intended to be subclassed by a simulation implementation; The subclass should implement the method ‘create_geometry’ which defines the simulation geometry and materials. The helper function ‘insert_layer’, ‘insert_drop_down_layers’, or similar should be called internally to create layers.

Common constructor for simulation classes.

Any parameter can be passed as a keyword argument.

Parameters:
  • layout – the layout on which to create the simulation

  • cell – top cell for the simulation. If not given, a new cell will be created.

create_geometry()[source]

Creates the simulation geometry.

This method is to be overridden, and the overriding method should describe self.layers and self.ports needed for the simulation geometry. It’s recommended to use self.insert_layer, self.insert_drop_down_layers, or similar to add new layers into the model.

simplified_region(region, expansion=0.0)[source]

Returns a region that is simplified by functions region_with_merged_polygons and region_with_merged_points. More precisely: - Merges polygons ignoring gaps that are smaller than self.polygon_tolerance - Expands/shrinks region by amount given by ‘expansion’ - In each polygon of the region, removes points that are closer than self.minimum_point_spacing to other points

insert_layer(layer_name, region, z0, z1, **params)[source]

Adds layer parameters into ‘self.layers’ if region is non-empty.

insert_drop_down_layers(stack, z0)[source]

Produces the drop-down layer stack-up and adds the layers into ‘self.layers’. Each layer is split into sub-layers by their z-level.

Parameters:
  • stack – list of layers in form of tuples containing (region, layer name, thickness, material)

  • z0 – the base z-level for the layer stack-up

static altitude(z)[source]

Returns rounded value of z to avoid issues due to rounding errors.

get_parameters()[source]

Return dictionary with all parameters and their values.

get_partition_regions()[source]

Returns partition regions for the simulation instance.

If member function not overridden, will simply return whatever was passed as partition_regions, if any. Can be overridden, for example, to use partition regions defined in kqcircuits.simulations.epr.

visualise_region(region: Region, label: str, layer: str = 'visualisation', points: list[DPoint] | DPoint | None = None) → None[source]

Visualises given region in a dedicated layer in the preview geometry file.

Parameters:
  • region – pya.Region to visualise

  • label – Label of the region, rendered using pya.DText objects

  • layer – Name of the KLayout layer to place the visualised region

  • points – pya.DPoint or list of DPoints to place as labels to the region. By default places one point at the middle of the region’s boundary box.

PCell parameters:

  • partition_regions (String) - See constructor of the PartitionRegion class for parameter definitions., default=[]

  • use_ports (Boolean) - Turn off to disable all ports (for debugging), default=True

  • port_size (Double) - The port size can also be set as a list specifying the extensions from the center of the port to left, right, down and up, respectively., default=400.0, unit=µm

  • minimum_point_spacing (Double) - Tolerance for merging adjacent points in polygon, default=0.01, unit=µm

  • polygon_tolerance (Double) - Tolerance for merging adjacent polygons in a layer, default=0.004, unit=µm

  • small_shape_area (Double) - Area below which shapes will trigger a warning., default=1.0, unit=µm²

  • parent_simulation (None) - Instance of LayerSimulation subclass to determine excitations, default=None

../_images/kqcircuits.simulations.layered_simulation.png