Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

865 gds handle multiplanar design with multiple chip names and layer. #869

Merged
merged 3 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion qiskit_metal/designs/design_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class QDesign():
"""
# pylint: disable=too-many-instance-attributes, too-many-public-methods

# Dummy private attribute used to check if an instanciated object is
# Dummy private attribute used to check if an instantiated object is
# indeed a QDesign class. The problem is that the `isinstance`
# built-in method fails when this module is reloaded.
# Used by `is_design` to check.
Expand Down
56 changes: 56 additions & 0 deletions qiskit_metal/designs/design_multiplanar.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from qiskit_metal.designs.design_base import QDesign
from qiskit_metal.toolbox_metal.layer_stack_handler import LayerStackHandler
from addict import Dict
from typing import Tuple

__all__ = ['MultiPlanar']

Expand Down Expand Up @@ -92,3 +93,58 @@ def _add_chip_info(self):
size_x='9mm',
size_y='7mm',
)

def get_x_y_for_chip(self, chip_name: str) -> Tuple[tuple, int]:
"""If the chip_name is in self.chips, along with entry for size
information then return a tuple=(minx, miny, maxx, maxy). Used for
subtraction while exporting design.

Args:
chip_name (str): Name of chip that you want the size of.

Returns:
Tuple[tuple, int]:
tuple: The exact placement on rectangle coordinate (minx, miny, maxx, maxy).
int: 0=all is good
1=chip_name not in self._chips
2=size information missing or no good
"""
x_y_location = tuple()

if chip_name in self._chips:
if 'size' in self._chips[chip_name]:

size = self.parse_value(self.chips[chip_name]['size'])
if 'center_x' in size \
and 'center_y' in size \
and 'size_x' in size \
and 'size_y' in size:
if type(size.center_x) in [int, float] and \
type(size.center_y) in [int, float] and \
type(size.size_x) in [int, float] and \
type(size.size_y) in [int, float]:
x_y_location = (
size['center_x'] - (size['size_x'] / 2.0),
size['center_y'] - (size['size_y'] / 2.0),
size['center_x'] + (size['size_x'] / 2.0),
size['center_y'] + (size['size_y'] / 2.0))
return x_y_location, 0

self.logger.warning(
f'Size information within self.chips[{chip_name}]["size"]'
f' is NOT an int or float.')
return x_y_location, 2

self.logger.warning('center_x or center_y or size_x or size_y '
f' NOT in self._chips[{chip_name}]["size"]')
return x_y_location, 2

self.logger.warning(
f'Information for size in NOT in self._chips[{chip_name}]'
' dict. Return "None" in tuple.')
return x_y_location, 2

self.logger.warning(
f'Chip name "{chip_name}" is not in self._chips dict. Return "None" in tuple.'
)
return x_y_location, 1
Loading