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) or a dictionary with keys as pya.DPoints representing chip coordinate and as value a dictionary containing the keys chip_name, local_chip_trans and position_label. example: {pya.DPoint(-500,1000):{‘chip_name’: ‘ABC’, ‘local_chip_trans’: pya.DTrans(pya.DVector(1800, -1800)) * pya.DTrans().M90 , ‘position_label’:’H08’}}

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. Only used when the main chip map is not a dictionary.

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

insert_chips()[source]

Insert chips after resolving their position labels

static generate_position_label(chip_placement_list, unit_x, unit_y)[source]

Generate a position label based on the coordinate of each chip.

Parameters:
  • chip_placement_list – list of lists [[chip_size, chip_coordinate, chip_name, position_label]]

  • unit_x – minimum chip x dimension

  • unit_y – minimum chip y dimension

Returns: Dictionary with the global coordinates of each chip of the sub array. It has the form

{(coord_x, coord_y): {‘chip_name’: name, ‘position_label’: xxx}}

generate_and_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.

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

Inserts position labels and mask name into chip frames, and then updates self.chip_copies dictionary

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