QGDSRenderer¶
- class QGDSRenderer(design: QDesign, initiate=True, render_template: Dict = None, render_options: Dict = None)[source]¶
Extends QRenderer to export GDS formatted files. The methods which a user will need for GDS export should be found within this class.
All chips within design should be exported to one gds file. For the “subtraction box”: 1. If user wants to export the entire design, AND if the base class of QDesign._chips[chip_name][‘size’] has dict following below example: {‘center_x’: 0.0, ‘center_y’: 0.0, ‘size_x’: 9, ‘size_y’: 6} then this box will be used for every layer within a chip.
2. If user wants to export entire design, BUT there is no information in QDesign._chips[chip_name][‘size’], then the renderer will calculate the size of all of the components and use that size for the “subtraction box” for every layer within a chip.
3. If user wants to export a list of explicit components, the bounding box will be calculated by size of QComponents in the QGeometry table. Then be scaled by bounding_box_scale_x and bounding_box_scale_y.
4. Note: When using the Junction table, the cell for Junction should be “x-axis” aligned and then GDS rotates based on LineString given in Junction table.
- datatype:
10 Polygon
11 Flexpath
- Default Options:
short_segments_to_not_fillet: ‘True’
check_short_segments_by_scaling_fillet: ‘2.0’
gds_unit: ‘1’
ground_plane: ‘True’
negative_mask: Dict(main=[])
corners: ‘circular bend’
tolerance: ‘0.00001’
precision: ‘0.000000001’
width_LineString: ‘10um’
path_filename: ‘../resources/Fake_Junctions.GDS’
junction_pad_overlap: ‘5um’
max_points: ‘199’
fabricate: ‘False’
- cheese: Dict
datatype: ‘100’
shape: ‘0’
cheese_0_x: ‘50um’
cheese_0_y: ‘50um’
cheese_1_radius: ‘100um’
delta_x=’100um’,
delta_y=’100um’,
edge_nocheese=’200um’,
view_in_file: Dict(main={1: True})
- no_cheese: Dict
datatype: ‘99’
buffer: ‘25um’
cap_style: ‘2’
join_style: ‘2’
view_in_file: Dict(main={1: True})
bounding_box_scale_x: ‘1.2’
bounding_box_scale_y: ‘1.2’
Create a QRenderer for GDS interface: export and import.
- Parameters:
design (QDesign) – Use QGeometry within QDesign to obtain elements for GDS file.
initiate (bool, optional) – True to initiate the renderer. Defaults to True.
render_template (Dict, optional) – Typically used by GUI for template options for GDS. Defaults to None.
render_options (Dict, optional) – Used to override all options. Defaults to None.
Attributes
- default_options = {'bounding_box_scale_x': '1.2', 'bounding_box_scale_y': '1.2', 'check_short_segments_by_scaling_fillet': '2.0', 'cheese': {'cheese_0_x': '25um', 'cheese_0_y': '25um', 'cheese_1_radius': '100um', 'datatype': '100', 'delta_x': '100um', 'delta_y': '100um', 'edge_nocheese': '200um', 'shape': '0', 'view_in_file': {'main': {1: True}}}, 'corners': 'circular bend', 'fabricate': 'False', 'gds_unit': '1', 'ground_plane': 'True', 'junction_pad_overlap': '5um', 'max_points': '199', 'negative_mask': {'main': []}, 'no_cheese': {'buffer': '25um', 'cap_style': '2', 'datatype': '99', 'join_style': '2', 'view_in_file': {'main': {1: True}}}, 'path_filename': '../resources/Fake_Junctions.GDS', 'precision': '0.000000001', 'short_segments_to_not_fillet': 'True', 'tolerance': '0.00001', 'width_LineString': '10um'}¶
Default options
- design¶
Return a reference to the parent design object.
- element_extensions = {}¶
Element extensions dictionary
- element_table_data = {'junction': {'cell_name': 'my_other_junction'}}¶
Element table data
- logger¶
Returns the logger.
- name = 'gds'¶
Name
- options¶
Options for the QRenderer.
Methods
- add_table_data_to_QDesign(class_name: str)¶
During init of renderer, this needs to happen. In particular, each renderer needs to update custom columns and values within QDesign.
- Parameters:
class_name (str) – Name from cls.name for each renderer.
- export_to_gds(file_name: str, highlight_qcomponents: list | None = None) int [source]¶
Use the design which was used to initialize this class. The QGeometry element types of both “path” and “poly”, will be used, to convert QGeometry to GDS formatted file.
- Parameters:
file_name (str) – File name which can also include directory path. If the file exists, it will be overwritten.
highlight_qcomponents (list) – List of strings which denote the name of QComponents to render. If empty, render all components in design.
- Returns:
0=file_name can not be written, otherwise 1=file_name has been written
- Return type:
int
- static get_renderer(name: str)¶
Returns an already loaded and instantiated renderer.
- Parameters:
name (str) – rendering name
- Returns:
Renderer with the given name
- Return type:
- classmethod get_template_options(design: QDesign, render_template: Dict = None, logger_: Logger = None, template_key: str = None) Dict ¶
Creates template options for the Metal QRenderer class required for the class to function, based on the design template; i.e., be created, made, and rendered. Provides the blank option structure required.
The options can be extended by plugins, such as renderers.
- Parameters:
design (QDesign) – A design class.
render_template (Dict, optional) – Template options to overwrite the class ones. Defaults to None.
logger (logging.Logger, optional) – A logger for errors. Defaults to None.
template_key (str, optional) – The design.template_options key identifier. If None, then use _get_unique_class_name(). Defaults to None.
- Returns:
Dictionary of renderer’s default options based on design.template_options.
- Return type:
Dict
- get_unique_component_ids(highlight_qcomponents: list | None = None) Tuple[list, int] ¶
Confirm the list doesn’t have names of components repeated. Confirm that the name of component exists in QDesign. If QDesign doesn’t contain any component, or if all components in QDesign are found in highlight_qcomponents, return an empty list; otherwise return a list of unique components to be sent to the renderer. The second returned item, an integer, specifies which of these 3 cases applies.
- Parameters:
highlight_qcomponents (Union[list, None], optional) – Components to render. Defaults to None.
- Returns:
- Tuple: Empty or partial list of components in QDesign.
- int: 0 subset selected
1 every component selected 2 invalid
- Return type:
Tuple[list, int]
- classmethod load()¶
Load the renderer and register all its extensions. Only performed once.
Once complete, the renderer is added to the class attribute ‘__loaded_renderers__’ of QRenderer
- Returns:
True if success, otherwise throws an error.
- Return type:
bool
- new_gds_library() GdsLibrary [source]¶
Creates a new GDS Library. Deletes the old. Create a new GDS library file. It can contains multiple cells.
- Returns:
GDS library which can contain multiple cells.
- Return type:
gdspy.GdsLibrary
- parse_value(value: Any | List | Dict | Iterable) Any ¶
Same as design.parse_value. See design for help.
- Returns:
Parsed value of input.
- Return type:
object
- classmethod populate_element_extensions()¶
Populate cls.element_extensions which will be used to create columns for tables in QGeometry tables.
The structure of cls.element_table_data should be same as cls.element_extensions.
- start(force=False)¶
Call any initialization (single run) step required to setup the renderer for the first execution, such as connecting to some API or COM, or importing the correct material libraries, etc.
- Parameters:
force (bool) – If True, need to scrap the existing initialization and re-do If False, will start a new one only if none exists. Defaults to False.
- Returns:
is the renderer initialized successfully (thus usable?)
- Return type:
bool
- stop()¶
Any calls that one may want to make after a rendering is complete.
- update_options(render_options: Dict | None = None, render_template: Dict | None = None)¶
If template options has not been set for this renderer, then gather all the default options for children and add to design. The GUI would use this to store the template options.
Then give the template options to render to store in self.options. Then user can over-ride the render_options.
- Parameters:
render_options (Dict, optional) – If user wants to over-ride the template options. Defaults to None.
render_template (Dict, optional) – All the template options for each child. Defaults to None.