Open M3K33L opened 1 month ago
Hi! Do you rerun just the one cell, or the entire notebook from the beginning? Latter is preferred.
Could you try running the notebook code in the python interpreter, to see if that causes errors too? If you just type python
in command line, it should open an interactive console where you can write python code. You can always write exit()
to close it.
Then in python interpreter write these code lines one by one and let me know if there are errors:
from kqcircuits.klayout_view import KLayoutView
from kqcircuits.chips.demo import Demo
view = KLayoutView()
view.insert_cell(Demo, name_chip="ABC")
Hi! I ended up deleting all files related to KQC from my computer, then doing a new git clone. Then, I made a venv through python rather than conda. Using that venv, I pip installed KQC from scratch as a standalone. Then, I opened Spyder to test out the view, and at first it said that no module kqcircuits existed. To fix that, I restarted kernel and found that I needed to pip install spyder-kernel in my venv. Then, it worked! Success!
I do have some questions though. The way that I was trying to debug my chip was to include a new variable
testrefs = self.refpoints
print(testrefs)
Which let me view the refpoints as I added elements to my chip. Is there a better way that you'd recommend?
Also, for general development of an element, should I create a class in this program then add that to the view? Or should I create my element elsewhere and re-run my code after making edits in the other file? The reason I ask is: whenever I modified my chip, I had to restart kernel for the changes to take effect. I haven't gotten to try modifying a class within this same program.
Recommended way for now is to include the code where you implement your element in the directories of the source code, that is chips in klayout_package/python/kqcircuits/chips, elements in klayout_package/python/kqcircuits/elements, junctions in klayout_package/python/kqcircuits/junctions etc. If you re-run the cell where you import your element, it should then get the most recent version of your element, I don't think reloading the kernel should be necessary.
If you're using jupyter notebooks then if you put the following code in the cell, then rerun the import cell and then the following cell, it should show you visually how your element looks like in its most up-to-date version:
view.insert_cell(YourElement)
view.show(width=800)
Using jupyter notebooks might be a bit constrained as it only allows you to interact with your design through pictures. We would recommend installing KLayout as a GUI application as instructed here. Then you can find your design in the bottom left "Libraries" panel and you can drag-and-drop your design into the layout. Then you can double-click your design and change the PCell parameters to see that they work as intended. More instructions here.
If you use pycharm or Visual studio code editors to write your code, you can set up a shortcut such that it takes the code file you have open, then boots KLayout with that element centered and zoomed out, which you can do during the iterative process of refining your design. Instructions on how to set that up is here
What happened? What you expected to happen?
I am trying to use the example notebook from the developer setup to create a new element (to avoid reloading my library to check my progress over and over). I opened the notebook by using Anaconda Navigator's installed Jupyter Lab, within my virtual environment for KQC. The first time I used the notebook, it worked fine, but the second time I ran the kernel, I got this error:
I uninstalled the Salt package, and uninstalled KQC. Then, with a fresh git pull, I reinstalled KQC developer with
Which resulted in the following:
Then, I tried to go back to the notebook, but still got the same error. I'm not sure where to go next.
Versions
KQCircuits: 4.8.2 KLayout: 0.29.4 Python: 3.11.9 OS: Windows Version 10.0.22631 Build 22631
Issue Severity
Medium: significant difficulty but I can work around it