-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve probepoint export according to current standards
* single-reference support * assign "west" and "east" probers * unit tests * macro to visualise exported probepoints for visual inspection
- Loading branch information
Showing
7 changed files
with
1,020 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
321 changes: 258 additions & 63 deletions
321
klayout_package/python/kqcircuits/util/export_helper.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
klayout_package/python/scripts/macros/generate/visualise_probepoints.lym
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<klayout-macro> | ||
<description>Visualise probepoints from json file to layout</description> | ||
<version/> | ||
<category>pymacros</category> | ||
<prolog/> | ||
<epilog/> | ||
<doc/> | ||
<autorun>false</autorun> | ||
<autorun-early>false</autorun-early> | ||
<priority>0</priority> | ||
<shortcut/> | ||
<show-in-menu>false</show-in-menu> | ||
<group-name/> | ||
<menu-path/> | ||
<interpreter>python</interpreter> | ||
<dsl-interpreter-name/> | ||
<text># This code is part of KQCircuits | ||
# Copyright (C) 2023 IQM Finland Oy | ||
# | ||
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public | ||
# License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later | ||
# version. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with this program. If not, see | ||
# https://www.gnu.org/licenses/gpl-3.0.html. | ||
# | ||
# The software distribution should follow IQM trademark policy for open-source software | ||
# (meetiqm.com/developers/osstmpolicy). IQM welcomes contributions to the code. Please see our contribution agreements | ||
# for individuals (meetiqm.com/developers/clas/individual) and organizations (meetiqm.com/developers/clas/organization). | ||
|
||
|
||
"""Visualises the probepoints in external JSON file. | ||
Open or generate chip geometry then run this macro with specified filename | ||
to compare that the probepoints align with chip components. | ||
After running this macro, right click the Layers panel (on the right by default) | ||
and choose "Add Other Layer Entries". | ||
""" | ||
|
||
import json | ||
from kqcircuits.klayout_view import KLayoutView | ||
from kqcircuits.pya_resolver import pya | ||
from kqcircuits.util.export_helper import generate_probepoints_json | ||
|
||
# SPECIFY ARGUMENTS | ||
FILENAME = "" # Probepoint JSON file to visualise | ||
FLIP_FACE = False # Mirrors points wrt Y-axis. Recommended for flipchips | ||
FACE = '1t1' # Specify substrate face to probe | ||
|
||
cell = KLayoutView(current=True).active_cell | ||
|
||
with open(FILENAME) as f: | ||
probepoint_json = json.load(f) | ||
|
||
bbox_for_face = cell.dbbox_per_layer( | ||
cell.layout().layer( | ||
[l for l in cell.layout().layer_infos() if l.name == f"{FACE}_base_metal_gap_wo_grid"][0] | ||
) | ||
) | ||
|
||
def to_dtext(text_string, json_object): | ||
x = json_object["x"] * 1e3 | ||
y = json_object["y"] * 1e3 | ||
if FLIP_FACE: | ||
x = bbox_for_face.p2.x - x | ||
else: | ||
x += bbox_for_face.p1.x | ||
y += bbox_for_face.p1.y | ||
return pya.DText(text_string, x, y) | ||
|
||
def visualise_point(group, layer_string, text_string, json_object): | ||
layer_name = layer_string if not group else f"{group}_{layer_string}" | ||
cell.shapes(cell.layout().layer(layer_name)).insert(to_dtext(text_string, json_object)) | ||
|
||
def visualise_group(group): | ||
visualise_point(group.get("id"), "alignment", "alignment", probepoint_json["alignment"]) | ||
for site in probepoint_json["sites"]: | ||
visualise_point(group.get("id"), "east", site["id"], site["east"]) | ||
visualise_point(group.get("id"), "west", site["id"], site["west"]) | ||
|
||
for layer in cell.layout().layer_infos(): | ||
if "alignment" in layer.name or "west" in layer.name or "east" in layer.name: | ||
cell.shapes(cell.layout().layer(layer)).clear() | ||
|
||
if "groups" in probepoint_json: | ||
for group in groups: | ||
visualise_group(group) | ||
else: | ||
visualise_group(probepoint_json)</text> | ||
</klayout-macro> |
Oops, something went wrong.