Open qpavsmi opened 1 year ago
Hi @qpavsmi Since Unitary fund hackathon is over I would like to take on this issue as an open source contribution can I know some details on the issue
Hi @qpavsmi Since Unitary fund hackathon is over I would like to take on this issue as an open source contribution can I know some details on the issue
Hi, thanks for the interest! What detail would you like to know that is not provided in the issue description, or is the problem that the description is not easy to follow (apologies if that is the case).
Hi @qpavsmi Since Unitary fund hackathon is over I would like to take on this issue as an open source contribution can I know some details on the issue
Hi, thanks for the interest! What detail would you like to know that is not provided in the issue description, or is the problem that the description is not easy to follow (apologies if that is the case).
yeah thanks Pavel so I would like to know the changes should be made in which directory and which file
Probably the change only needs to be made in klayout_package/python/kqcircuits/simulations/simulation.py
. Probably need to add a new function there and then call that function as a last step in __init__
Probably the change only needs to be made in
klayout_package/python/kqcircuits/simulations/simulation.py
. Probably need to add a new function there and then call that function as a last step in__init__
I will have a look
Prerequisites
KQCircuits, GUI and standalone installations
Issue description
When exporting files to be used by an external FEM simulation software, KQCircuits will usually show a preview of the geometry files that will be used for simulations in KLayout to review that the correct geometry is placed in correct layers. We also export some coordinates within geometry as "ports" in separate json files to be used by the simulation software. These ports do not show up in KLayout, and it's inconvenient to look them up from a separate file to see how the coordinates match with the design geometry. During the preview it would be good to have the port coordinates be outlined as text objects in KLayout.
How to get started
Go to root of the KQCircuits source code folder and run:
python klayout_package/python/scripts/simulations/xs1_full_chip_sim.py
This will cause a KLayout window to pop up, showing geometry of an example chip for which a simulation can be run (remove some clutter double-clicking the
refpoints
layer to hide it). The python script will also generate thetmp
subfolder if not present already, with a foldertmp/xs1_full_chip_sim_output
inside. Inside that folder there issimulation.oas
design file, which is exactly what the pop up window shows.Review the contents of the
tmp/xs1_full_chip_sim_output/Simulation.json
file. Look through the"ports"
list. You will see that ports numbered 1-8 are of typeEdgePort
, and the rest of the ports are of typeInternalPort
. These are the two classes of ports that are used in KQCircuits. EdgePorts are placed at the edge of the simulation region and InternalPorts are placed inside the region. Every port is defined bysignal_location
2D coordinate, InternalPorts may additionally have aground_location
2D coordinate.You can compare the port locations as exported to
tmp/xs1_full_chip_sim_output/Simulation.json
with how we define the ports in single_xmons_full_chip_sim.py. There are two calls ofself.ports.append
,EdgePort
s are placed for the launchers andInternalPort
s are added for the SQUID parts of qubits, signal locations located at the edge of qubits' inner metal part and ground locations located outside of qubits. See below charts.These would be good to illustrate by placing text objects similar to what we currently do in the
refpoints
layer. We already place some visualisation elements during simulation preview using the function visualise_region. Currently we do that with taking XSections and defining PartitionRegions.Using
visualise_region
you can set the name of thelayer
drawing shapes for visualisation purposes, let's call itsimulation_ports
. You can also specify thelabel
of the text object. The label should specify the port index and type, for exampleedge_port_1
,internal_port_signal_2
,internal_port_ground_3
. So a way to place a single text object as a point could be:Since
EdgePort
s are always placed at edges of the simulation box, you can infer the direction of the port based on which edge of the box the port is placed in. It would be nice if the port would be visualised as a line segment that starts from port location and extends for some length outside of the box, as presented in first illustration. See the first argumentpya.Region()
in the example call ofvisualise_region
. This constructs an "empty" region, which means that only the text object is placed, and no polygons. You might consider visualising the ports as 2D shapes in the case ofEdgePort
sSuppose we want to place a vertical line of width
w
from 2D point(x,y1)
to(x,y2)
. We can just draw it using a box:pya.Region(pya.DBox(x-w, y1, x+w, y2).to_itype(self.layout.dbu))
. Herepya.DBox
is defined in domain specific units (in this case microns), butpya.Region
only accepts KLayout's internal integer measurements. Therefore we need to convert thepya.DBox
to integer units using.to_itype(self.layout.dbu)
. You could also setw=0
if you'd prefer infinitely thin lines, these still get rendered in the KLayout window.For
InternalPort
s you might also draw a line fromsignal_location
toground_location
. Notice that the line might have some angled direction, in which case using apya.DBox
might not look correct, so you could instead use a pya.DPolygon with four points. Notice also thatground_location
is an optional property, so if it is not defined, just placing a text point is enough.The port visualisation code should run as last call in
Simulation.__init__
function. You should have access to all ports fromSimulation.ports
attribute, which gets populated afterbuild
call.Definition of done
simulation.oas
in a separate layer. Ports should convey their location, index and type of port as defined in the json files.