QComponent¶
- class QComponent(design: QDesign, name: str = None, options: Dict = None, make=True, component_template: Dict = None)[source]¶
QComponent is the core class for all Metal components and is the central construct from which all components in Metal are derived.
The class defines the user interface for working with components.
- For front-end user:
Manipulates the dictionary of options (stored as string-string key-value pairs) to change the geometry and properties of the component.
The options of the class are stored in an options dictionary. These include the geometric sizes, such as width=’10um’ or height=’5mm’, etc.
The make function parses these strings and implements the logic required to transform the dictionary of options (stored as strings) into shapes with associated properties.
- For creator user:
The creator user implements the make function (see above)
The class define the internal representation of a components
The class provides the interfaces for the component (creator user)
- Default Options:
pos_x/_y: ‘0.0um’ – The x/y position of the center of the QComponent.
orientation: ‘0.0’ – The primary direction in degrees of the QComponent. Expressed counter-clockwise orientation.
chip: ‘main’ – Chip holding the QComponent.
layer: ‘1’ – Manufacturing layer used for the QComponent.
Nested default options can be overwritten with the update function. The following code demonstrates how the update works.
1from qiskit_metal import Dict 2default = Dict( 3 a=1, 4 b=2, 5 c=Dict( 6 d=3, 7 e=4, 8 f=Dict( 9 g=6, 10 h=7 11 ) 12 ) 13) 14overwrite = Dict( 15 a=10, 16 b=20, 17 c=Dict( 18 d=30, 19 f=Dict( 20 h=70 21 ) 22 ), 23 z=33 24) 25default.update(overwrite) 26default
>> {‘a’: 10, ‘b’: 20, ‘c’: {‘d’: 30, ‘e’: 4, ‘f’: {‘g’: 6, ‘h’: 70}}, ‘z’: 33}
Create a new Metal component and adds it’s default_options to the design.
- Parameters:
design (QDesign) – The parent design.
name (str) – Name of the component. Auto-named if possible.
options (dict) – User options that will override the defaults. Defaults to None.
make (bool) – True if the make function should be called at the end of the init. Options be used in the make function to create the geometry. Defaults to True.
component_template (dict) – User can overwrite the template options for the component that will be stored in the design, in design.template, and used every time a new component is instantiated. Defaults to None.
- Raises:
ValueError – User supplied design isn’t a QDesign
- Note: Information copied from QDesign class.
self._design.overwrite_enabled (bool): When True - If the string name, used for component, already exists in the design, the existing component will be deleted from design, and new component will be generated with the same name and newly generated component_id, and then added to design.
When False - If the string name, used for component, already exists in the design, the existing component will be kept in the design, and current component will not be generated, nor will be added to the design. The variable design.self.status will still be NotBuilt, as opposed to Initialization Successful.
Either True or False - If string name, used for component, is NOT being used in the design, a component will be generated and added to design using the name.
Attributes
the full module name with the class name.
Component metadata
Default drawing options
Return a reference to the parent design object.
The unique id of component within a design.
The Qiskit Metal Logger.
Name of the component.
A dictionary of the component-designer-defined options.
The names of the pins.
Get a list of the names of the element tables.
Dictionary of pins.
Metadata allows a designer to store extra information or analysis results.
Stores the latest status of the component.
Methods
QComponent.add_dependency
(parent, child)Add a dependency between one component and another.
QComponent.add_pin
(name, points, width[, ...])Adds a pin from two points which are normal/tangent to the intended plane of the pin.
QComponent.add_qgeometry
(kind, geometry[, ...])Add QGeometry.
WARNING: Do NOT use this method during generation of component instance.
Delete the QComponent.
QComponent.get_pin
(name)Interface for components to get pin data.
QComponent.get_template_options
(design[, ...])Creates template options for the Metal Component class required for the class to function, based on the design template; i.e., be created, made, and rendered.
The make function implements the logic that creates the geometry (poly, path, etc.) from the qcomponent.options dictionary of parameters, and the adds them to the design, using qcomponent.add_qgeometry(...), adding in extra needed information, such as layer, subtract, etc.
QComponent.parse_options
([options])Parse the options, converting string into interpreted values.
QComponent.parse_value
(value)Parse a string, mappable (dict, Dict), iterable (list, tuple) to account for units conversion, some basic arithmetic, and design variables.
Use the element_handler to get a list of all the table names used in QGeometry.
Fetched the component bound dict_value.
QComponent.qgeometry_dict
(element_type)Returns a dict of element qgeometry (shapely geometry) of the component as a python dict, where the dict keys are the names of the qgeometry and the corresponding values are the shapely geometries.
QComponent.qgeometry_list
([element_type])Returns a list of element qgeometry (shapely geometry) of the component as a python list of shapely geometries.
QComponent.qgeometry_plot
([ax, plot_kw])Draw all the qgeometry of the component (polys and path etc.)
QComponent.qgeometry_table
(element_type)Returns the entire element table for the component.
Builds the QComponent.
QComponent.to_script
([thin, is_part_of_chip])- param thin:
If true then any key in the QComponent's options whose value