Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion qiskit_metal/qgeometries/qgeometries_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def is_qgeometry_table(obj):
subtract=bool, # do we subtract from the ground place of the chip
helper=bool, # helper or not
chip=str, # chip name
sublayer=int, # gds type of sublayer
# type=str, # metal, helper. poly=10 or path=11
__renderers__=dict(
# ADD specific renderers here, all renderes must register here.
Expand Down Expand Up @@ -445,6 +446,7 @@ def add_qgeometry(
helper: bool = False,
layer: Union[int, str] = 1, # chip will be here
chip: str = 'main',
sublayer: Union[int, str] = 10,
**other_options):
"""Main interface to add qgeometries.

Expand All @@ -456,6 +458,7 @@ def add_qgeometry(
helper (bool): Helper - passed through. Defaults to False.
layer (Union[int, str]): Layer - passed through. Defaults to 1.
chip (str): Chip name - passed through. Defaults to 'main'.
sublayer (Union[int, str]): Sublayer - passed through. Defaults to 0.
**other_options (object): Other_options - passed through.
"""
# TODO: Add unit test
Expand All @@ -472,7 +475,7 @@ def add_qgeometry(
f'Kind must be in {self.get_element_types()}. This failed for component'
f'name = `{component_name}`.\n'
f' The call was with subtract={subtract} and helper={helper}'
f' and layer={layer}, and options={other_options}')
f' and layer={layer}, and sublayer={sublayer} and options={other_options}')

#Checks if (any) of the geometry are MultiPolygons, and breaks them up into
#individual polygons. Rounds the coordinate sequences of those values to avoid
Expand Down Expand Up @@ -503,6 +506,7 @@ def add_qgeometry(
helper=helper,
layer=int(layer),
chip=chip,
sublayer=int(sublayer),
**other_options)

#replaces line above to generate the options.
Expand Down
9 changes: 8 additions & 1 deletion qiskit_metal/qlibrary/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class QComponent():
Expressed counter-clockwise orientation.
* chip: 'main' -- Chip holding the QComponent.
* layer: '1' -- Manufacturing layer used for the QComponent.
* sublayer: '10' -- Manufacturing sublayer used for the QComponent.

Nested default options can be overwritten with the update function.
The following code demonstrates how the update works.
Expand Down Expand Up @@ -120,7 +121,8 @@ class QComponent():
pos_y='0.0um',
orientation='0.0',
chip='main',
layer='1')
layer='1',
sublayer='10',)
"""Default drawing options"""

component_metadata = Dict()
Expand Down Expand Up @@ -1078,6 +1080,7 @@ def add_qgeometry(
helper: bool = False,
layer: Union[int, str] = None, # chip will be here
chip: str = None,
sublayer: Union[int, str] = None,
**kwargs):
r"""Add QGeometry.

Expand All @@ -1095,6 +1098,7 @@ def add_qgeometry(
Defaults to False.
layer (int, str): The layer to which the set of QGeometry will belong
Defaults to None, which is converted to self.options.chip.
sublayer (int, str): The sublayer to which the set of QGeometry will belong
chip (str): Chip name. Defaults to None, which is converted to
self.options.chip.
kwargs (dict): Parameters dictionary
Expand All @@ -1108,6 +1112,8 @@ def add_qgeometry(

if layer is None:
layer = self.options.layer
if sublayer is None:
sublayer = self.options.sublayer
if chip is None:
chip = self.options.chip

Expand Down Expand Up @@ -1137,6 +1143,7 @@ def add_qgeometry(
helper=helper,
layer=layer,
chip=chip,
sublayer=sublayer,
**renderer_and_options)

def _get_specific_table_values_from_renderers(self, kind: str) -> Dict:
Expand Down
10 changes: 5 additions & 5 deletions qiskit_metal/renderers/renderer_gds/gds_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,7 @@ class to a series of GDSII format on the input pd.Series.
exterior_poly = gdspy.Polygon(
list(geom.exterior.coords),
layer=qgeometry_element.layer,
datatype=10,
datatype=qgeometry_element.sublayer,
)

# If polygons have a holes, need to remove it for gdspy.
Expand All @@ -2294,7 +2294,7 @@ class to a series of GDSII format on the input pd.Series.
all_interiors.append(interior_coords)
a_poly_set = gdspy.PolygonSet(all_interiors,
layer=qgeometry_element.layer,
datatype=10)
datatype=qgeometry_element.sublayer)
# Since there is max_points in boolean, don't need to do this twice.
# a_poly_set = a_poly_set.fracture(max_points=max_points)
# exterior_poly = exterior_poly.fracture(max_points=max_points)
Expand All @@ -2304,7 +2304,7 @@ class to a series of GDSII format on the input pd.Series.
max_points=max_points,
precision=precision,
layer=qgeometry_element.layer,
datatype=10)
datatype=qgeometry_element.sublayer)
return a_poly

exterior_poly = exterior_poly.fracture(max_points=max_points,
Expand Down Expand Up @@ -2343,13 +2343,13 @@ class to a series of GDSII format on the input pd.Series.
use_width,
layer=qgeometry_element.layer,
max_points=max_points,
datatype=11)
datatype=qgeometry_element.sublayer+1)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is temporary. I need to properly check here whether it is None or not, and make it 11 as a default.
Otherwise, I am losing the ability to have Flexpaths and Polygon on the same datatype

else:
to_return = gdspy.FlexPath(
list(geom.coords),
use_width,
layer=qgeometry_element.layer,
datatype=11,
datatype=qgeometry_element.sublayer+1,
max_points=max_points,
corners=corners,
bend_radius=qgeometry_element.fillet,
Expand Down