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

824 multi planar #825

Merged
merged 8 commits into from
Aug 1, 2022
11 changes: 11 additions & 0 deletions qiskit_metal/designs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@

DesignPlanar


MultiPlanar
---------------

.. autosummary::
:toctree: ../stubs/

MultiPlanar


DesignFlipChip
---------------

Expand Down Expand Up @@ -71,6 +81,7 @@
from .. import is_design
from .design_base import QDesign
from .design_planar import DesignPlanar
from .design_multiplanar import MultiPlanar
from .design_flipchip import DesignFlipChip
from .net_info import QNet
from .interface_components import Components
94 changes: 94 additions & 0 deletions qiskit_metal/designs/design_multiplanar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# -*- coding: utf-8 -*-

# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
"""Module containing Multi-Planar design for CPW type
geometry. Supports tek file approach for layer stack definitions."""

#from typing import Tuple

from qiskit_metal.designs.design_base import QDesign
from qiskit_metal.toolbox_metal.layer_stack_handler import LayerStackHandler
from addict import Dict

__all__ = ['MultiPlanar']


class MultiPlanar(QDesign):
"""Metal class for a multiple planar design, consisting of either single or multiple chips.
Typically assumed to have some CPW geometries.

Inherits QDesign class.
"""

def __init__(self,
metadata: dict = None,
overwrite_enabled: bool = False,
enable_renderers: bool = True,
layer_stack_filename: str = None):
"""Pass metadata to QDesign.

Args:
metadata (dict, optional): Pass to QDesign. Defaults to {}.
overwrite_enabled (bool, optional): Passed to QDesign base class. Defaults to False.
enable_renderers (bool, optional): Passed to QDesign base class. Defaults to True.
"""

super().__init__(metadata=metadata,
overwrite_enabled=overwrite_enabled,
enable_renderers=enable_renderers)

#just using the single planar approach for the moment
#still have the different chips, or just all via layers?
self._add_chip_info()

#generates the table for the layer information
self.ls_filename = layer_stack_filename

# Note: layers numbers can be repeated since there can be datatypes.
self.ls = self._add_layer_stack()

self._uwave_package = Dict()
self._populate_uwave_values()

def _populate_uwave_values(self):
"""Can be updated by user.
"""
self._uwave_package[
'sample_holder_top'] = '890um', # how tall is the vacuum above center_z
self._uwave_package[
'sample_holder_bottom'] = '1650um' # how tall is the vacuum below z=0

def _add_layer_stack(self) -> LayerStackHandler:
"""Adds the data structure for the "layer_stack file" in the design for defining
the layer stack. Simple initial layer is generated (to support the default
layer used in all components).
"""
return LayerStackHandler(self)

def _add_chip_info(self):
"""Used to determine size of fill box by either 'size' data or box_plus_buffer.

GDSPY is using numbers based on 1 meter unit.
When the gds file is exported, data is converted to "user-selected" units.
centered at (0,0) and 9 by 6 size.

NOTE: self._chips dict comes from QDesign base class.
"""
self._chips['main'] = Dict()

self._chips['main']['size'] = Dict(
center_x='0.0mm',
center_y='0.0mm',
size_x='9mm',
size_y='7mm',
)
47 changes: 35 additions & 12 deletions qiskit_metal/toolbox_metal/layer_stack_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ def __init__(self,
# 'chip_name', 'layer', 'datatype', 'material', 'thickness',
# 'z_coord', 'fill'
# ]
self.layer_stack_default = Dict(chip_name=['main'],
layer=[1],
datatype=[0],
material=['pec'],
thickness=['2um'],
z_coord=['0um'],
fill=['true'])
self.layer_stack_default = Dict(chip_name=['main', 'main'],
layer=[1, 3],
datatype=[0, 0],
material=['pec', 'silicon'],
thickness=['2um', '-750um'],
z_coord=['0um', '0um'],
fill=['true', 'true'])

self._init_dataframe()
self.is_layer_data_unique()

def _init_dataframe(self) -> None:
"""Must check if filename for layerstack is valid before trying to import to a pandas table.
Expand Down Expand Up @@ -161,12 +162,25 @@ def get_properties_for_layer_datatype(
result.append(props[item])
return tuple(result)

def is_layer_unique(self) -> bool:
"""Check to sort on layer number make sure they are unique.
This method is not so relevant, since layers can have datatype entries.
Thus there can be rows with same layer number.
def is_layer_data_unique(self) -> bool:
"""For each layer number make sure the datatypes are unique. A layers can
#have multiple datatypes.

Returns:
bool: True if empty dataframe, True if for each layer, there is ONLY one datatype. Otherwise, False.
"""
return self.ls_df['layer'].is_unique
layer_nums = self.get_unique_layer_ints()
if layer_nums:
for num in layer_nums:
mask = self.ls_df['layer'] == num
search_result_num = self.ls_df[mask]
if not search_result_num.datatype.is_unique:
self.logger.warning(
f'There WILL BE PROBLEMS since layer {num} does not have unique datatypes.'
)
return False

return True

def _read_csv_df(self, abs_path: str) -> None:
#ASSUME that self.filename_csv_df is valid file path and name.
Expand All @@ -190,6 +204,15 @@ def get_unique_chip_names(self) -> set:
result = set(names.str.strip('\''))
return result

def get_unique_layer_ints(self) -> set:
"""Get a set of unique layer ints used in the layer_stack dataframe.

Returns:
set: Unique layer numbers used in the layer stack used as either default or provided by user.
"""
layers = self.ls_df['layer']
return set(layers.unique())

def _warning_properties(self, properties: list):
"""_Give warning if the properties is

Expand Down
4 changes: 1 addition & 3 deletions tutorials/resources/layer_stack_data_example.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
chip_name,layer,datatype,material,thickness,z_coord,fill
'main',1,0,'pec','2um','0um','True'
'main',3,0,'silicon','-500um','0um','True'
'qubit_chip',2,0,'pec','2um','100um','True'
'qubit_chip',4,0,'silicon','500um','102um','True'
'main',3,0,'silicon','-500um','0um','True'