squadds.gds package#
Submodules#
squadds.gds.processing module#
- squadds.gds.processing.add_703_layer(gds_file)[source]#
Adds a 703 layer datatype 0 rectangle covering the 5/0 layer in the GDS file.
- Parameters:
gds_file (str) β Path to the input GDS file.
- Returns:
None
- squadds.gds.processing.add_square_border_to_gds(input_gds_file, output_gds_file, size_um=5000, thickness_um=23, layer_number=1, datatype=0)[source]#
Adds a centered square border to the TOP cell of an existing GDS file.
- Parameters:
input_gds_file (str) β Path to the input GDS file.
output_gds_file (str) β Path to the output GDS file.
size_um (float) β Size of the outer square in micrometers. Defaults to 5000.
thickness_um (float) β Thickness of the square border in micrometers. Defaults to 23.
layer_number (int) β Layer number to assign the square. Defaults to 1.
datatype (int) β Datatype to assign the square. Defaults to 0.
- Returns:
None
- squadds.gds.processing.add_squares_to_layer(input_gds, output_gds, selected_layer, selected_datatype, square_size=5, spacing=10, keepout=5)[source]#
Adds squares to a specific layer in a GDS file.
- Parameters:
input_gds (str) β The path to the input GDS file.
output_gds (str) β The path to the output GDS file.
selected_layer (int) β The layer number to add squares to.
selected_datatype (int) β The datatype number to add squares to.
square_size (int, optional) β The size of the squares to be added. Defaults to 5.
spacing (int, optional) β The spacing between squares. Defaults to 10.
keepout (int, optional) β The keepout area around the existing shapes. Defaults to 5.
- squadds.gds.processing.apply_fixes(gds_file, datatype=0)[source]#
Applies the required fixes to the GDS file.
- Parameters:
gds_file (str) β Path to the input GDS file.
datatype (int, optional) β The new datatype value for all layers. Defaults to 0.
- Returns:
None
- squadds.gds.processing.bias_gds_features(input_gds, output_gds, bias, layer_number, datatype_number=None)[source]#
Biases features on a specific layer in a GDS file by expanding or contracting them by the specified amount using KLayout.
- Parameters:
input_gds (str) β The path to the input GDS file.
output_gds (str) β The path to the output GDS file.
bias (float) β The amount by which to bias the features (in microns). Positive values expand features, negative values contract them.
layer_number (int) β The layer number of the features to bias.
datatype_number (int, optional) β The datatype number of the features to bias. If None, all datatypes on the layer are biased.
- squadds.gds.processing.create_cheesing_effect(input_gds, output_gds, selected_layer, selected_datatype)[source]#
Creates a cheesing effect on a GDS file by subtracting a square layer from an original layer.
Parameters: - input_gds (str): The path to the input GDS file. - output_gds (str): The path to save the modified GDS file. - selected_layer (int): The layer number of the original and square layers. - selected_datatype (int): The datatype number of the original and square layers.
Returns: None
- squadds.gds.processing.create_marker_blocks(input_gds_file, output_gds_file, marker_size_um=8, marker_distance_um=52, border_thickness_um=23, layer_number=1, datatype=0, additional_marker_size_um=5, additional_layer_number=7, additional_datatype=0)[source]#
Creates marker blocks (squares) of a given size at a specified distance from the corners of the border in the TOP cell of an existing GDS file, and an additional set of smaller squares on a different layer/datatype.
- Parameters:
input_gds_file (str) β Path to the input GDS file.
output_gds_file (str) β Path to the output GDS file.
marker_size_um (float) β Size of the main marker squares in micrometers. Defaults to 8.
marker_distance_um (float) β Distance from the border corners in micrometers. Defaults to 52.
border_thickness_um (float) β Thickness of the border in micrometers. Defaults to 23.
layer_number (int) β Layer number to assign the main marker blocks. Defaults to 1.
datatype (int) β Datatype to assign the main marker blocks. Defaults to 0.
additional_marker_size_um (float) β Size of the additional marker squares in micrometers. Defaults to 5.
additional_layer_number (int) β Layer number for the additional marker squares. Defaults to 7.
additional_datatype (int) β Datatype for the additional marker squares. Defaults to 0.
- Returns:
None
- squadds.gds.processing.crop_top_left_rectangle(gds_file, width=300, height=100, layer_number=5, datatype=0)[source]#
Removes a 300 x 100 um rectangle from the top left of the layer_number/datatype rectangle in the GDS file.
- Parameters:
gds_file (str) β Path to the input GDS file.
width (int, optional) β Width of the rectangle to remove in micrometers. Defaults to 300.
height (int, optional) β Height of the rectangle to remove in micrometers. Defaults to 100.
layer_number (int, optional) β The layer number of the rectangle to crop. Defaults to 5.
datatype (int, optional) β The datatype of the rectangle to crop. Defaults to 0.
- Returns:
None
- squadds.gds.processing.delete_non_zero_datatype_layers(gds_file)[source]#
Deletes all layers with datatypes not equal to 0 from the GDS file.
- Parameters:
gds_file (str) β Path to the input GDS file.
- Returns:
None
- squadds.gds.processing.flatten_to_top_cell(gds_file, output_gds_file=None, prune=True)[source]#
Flattens all hierarchical cells in the input GDS file into the top cell.
This function reads the specified GDS file using KLayoutβs database API, flattens the hierarchical structure (i.e. merges all cell instances into the top-level cell) using the specified prune option, and writes the resulting flattened layout to an output GDS file. If no output file name is provided, the function saves the flattened layout with the suffix β_flattened.gdsβ.
- Parameters:
gds_file (str) β Path to the input GDS file.
output_gds_file (str, optional) β Path to the output flattened GDS file. Defaults to None, in which case the output filename is derived from gds_file.
prune (bool, optional) β Whether to prune empty cells during flattening. Defaults to True.
- Returns:
None
- squadds.gds.processing.get_all_layer_numbers(gds_file)[source]#
Retrieves all unique layer numbers present in the GDS file.
- Parameters:
gds_file (str) β Path to the input GDS file.
- Returns:
A list of tuples, where each tuple contains (layer_number, datatype).
- Return type:
list
- squadds.gds.processing.invert_layer(gds_file, layer_number, datatype, output_gds_file=None)[source]#
Inverts a specified layer and datatype in a GDS file such that all areas with shapes become holes, and all areas without shapes become filled.
- Parameters:
gds_file (str) β Path to the input GDS file.
layer_number (int) β The layer number to invert.
datatype (int) β The datatype of the layer to invert.
output_gds_file (str, optional) β Path to the output GDS file. If None, a default output file name is generated.
- Returns:
None
- squadds.gds.processing.merge_shapes_in_layer(gds_file, output_gds_file, layer_number)[source]#
Selects all shapes in the given layer number from the input GDS file, merges them together, and saves the result in the output GDS file.
- Parameters:
gds_file (str) β Path to the input GDS file.
output_gds_file (str) β Path to the output GDS file.
layer_number (int) β The layer number whose shapes should be merged.
- Returns:
None