kqcircuits.masks.mask_layout

class kqcircuits.masks.mask_layout.MaskLayout(layout, name, version, with_grid, chips_map, face_id, **kwargs)[source]

Bases: object

Class representing the mask for a certain face.

A MaskLayout is used to create the cells for the mask.

layout

pya.Layout for this mask

name

Name of the mask

version

Mask version

with_grid

Boolean determining if ground grid is generated

face_id

face_id of this mask layout, “1t1” | “2b1” | “2t1”

layers_to_mask

dictionary of layers with mask label postfix for mask label and mask covered region creation

covered_region_excluded_layers

list of layers in layers_to_mask for which mask covered region is not created

chips_map

List of lists (2D-array) of strings, each string is a chip name (or — for no chip)

align_to

optional exact point of placement, an (x, y) coordinate tuple. By default the mask is centered.

chips_map_legend

Dictionary where keys are chip names, values are chip cells

wafer_rad

Wafer radius

wafer_center

Wafer center as a pya.DVector

chips_map_offset

Offset to make chips_map centered on wafer

wafer_top_flat_length

length of flat edge at the top of the wafer

wafer_bottom_flat_length

length of flat edge at the bottom of the wafer

dice_width

Dicing width for this mask layout

text_margin

Text margin for this mask layout

chip_size

side width of the chips (for square chips), or tuple (width, height) for rectangular chips

edge_clearance

minimum clearance of outer chips from the edge of the mask

remove_chips

if True (default), chips that violate edge_clearance or conflict with markers are removed from chip maps. Note that extra_chips are never removed.

chip_box_offset

Offset (pya.DVector) from chip origin of the chip frame boxes for this face

chip_trans

DTrans applied to all chips

mask_name_offset

(DEPRECATED) mask name label offset from default position (DPoint)

mask_name_scale

text scaling factor for mask name label (float)

mask_name_box_margin

margin around the mask name that determines the box size around the name (float)

mask_text_scale

text scaling factor for graphical representation layer (float)

mask_markers_dict

dictionary of all markers to be placed and kwargs to determine their position (dict)

mask_marker_offset

offset of mask markers from wafer center in horizontal and vertical directions (float)

mask_export_layers

list of layer names (without face_ids) to be exported as individual mask .oas files

mask_export_density_layers

list of layer names (without face_ids) for which we want to calculate the coverage density

submasks

list of submasks, each element is a tuple (submask mask_layout, submask position)

extra_id

extra string used to create unique name for mask layouts with the same face_id

extra_chips

List of tuples (name, position, trans, position_label) for chips placed outside chips_map trans is an optional transformation to use in place of self.chip_trans position_label is an optional string that overrides the automatic chip position label in the mask grid

top_cell

Top cell of this mask layout

added_chips

List of (chip name, chip_cell, chip position, chip bounding box, chip dtrans, position_label) populated by chips added during build()

chips_placed_by_position_label

Dictionary of {position_label: chip_name} where the chip exists in chips_map_legend and will be placed according to the position_label

chip_copies

Dictionary of {name_copy: properties} where properties contains the name and location data for each chip that was actually added to the mask.

mirror_labels

Boolean, if True mask and chip copy labels are mirrored. Default False.

bbox_face_ids

List of face_ids to consider when calcualting the bounding box of chips. Defaults to [face_id]

add_chips_map(chips_map, align=None, align_to=None, chip_size=None, chip_trans=None)[source]

Add additional chip maps to the main chip map.

The specified extra chip map, a.k.a. sub-grid, will be attached to the main grid. It may use different chip size than the main grid. For convenience left and rigtht sub-grids will be rotated 90 degrees clockwise.

Parameters:
  • chips_map – List of lists (2D-array) of strings, each string is a chip name (or — for no chip)

  • align – to what side of the main grid this sub-grid attaches. Allowed values: top, left, right and bottom.

  • align_to – optional exact point of placement. (x, y) coordinate tuple

  • chip_size – a different chip size may be used in each sub-grid

  • chip_trans – chip transformation to use for chips in this sub-grid, defaults to self.chip_trans.

build(chips_map_legend)[source]

Builds the cell hierarchy for this mask layout.

Inserts cells copied from chips_map_legend to self.top_cell at positions determined by self.chips_map. The copied cells are modified to only have layers corresponding to self.face_id, and they are translated and/or mirrored correctly based on self.face_id. Also inserts cells for mask markers, mask name label, and the circular area covered by the mask.

Parameters:

chips_map_legend – Dictionary where keys are chip names, values are chip cells

overwrite_chips_by_position_label(chips_dict)[source]

Overwrites chips with ones configured to be placed at specific label positions.

Chips specified in the chips_placed_by_position_label dictionary replace existing chips with the same position label

Parameters:

chips_dict – {(x, y): (chip_name, _, bbox, dtrans, position_label, mask_layout)}

insert_chips()[source]

Insert chips after resolving their position labels

insert_chip_copy_labels(labels_cell, layers, mask_name_for_chip=None)[source]

Inserts chip copy labels to all chips in this mask layout and its submasks

Parameters:
  • labels_cell – Cell to which the labels are inserted

  • layers – list of layer names (without face_ids) where the labels are produced

  • mask_name_for_chip – mask name to place on each chip, or None (default) to not add mask names to the chip.

face()[source]

Returns the face dictionary for this mask layout

static two_coordinates_to_position_label(row: int, column: int) str[source]

Converts two integers to chip position label, e.g. (2,3) -> ‘C03’

static position_label_to_two_coordinates(position_label: str) Tuple[int, int][source]

Converts chip position label to two integer coordinate, e.g. ‘C03’ -> (2,3)

../_images/kqcircuits.masks.mask_layout.png