gdsfactory / gplugins

gdsfactory plugins
https://gdsfactory.github.io/gplugins/
MIT License
35 stars 30 forks source link

Using kweb for gds visualization in jupyter book #30

Closed st4eve closed 1 year ago

st4eve commented 1 year ago

I am trying to use the jupyter based kweb gds viewer to display chips on our local lab server. Currently we are compiling markdown and ipynb files using jupyter book. I have managed to get the kweb to display gds files within the browser. I first launch a kweb server using jupyter run and a python script that sets the KWEB port and then launches the server. However, this server is only able to display the most recently executed chip.plot() command when the notebooks are built using jupyter book. The built site is able to communicate with a python kernel using thebe but jupyter book does not currently support using a local kernel. As of right now I am not sure if it is possible to switch between different gds files within the browser.

A dropdown menu might be enough to make this work. A way for compiled jupyter books to interact with the kweb server would also help.

The notebook being compiled with jupyter book:

Purple Chip A

import gdsfactory as gf
import amf
from kweb.server_jupyter import start

chipA = gf.import_gds("/home/st4eve/purple/mask-design/purple-chip-A.gds")
chipB = gf.import_gds("/home/st4eve/purple/mask-design/purple-chip-B.gds")
start()
chipA.plot()

Script that starts kweb server:

from kweb.server_jupyter import start
import os
os.environ['KWEB_PORT'] = '8000'
start()

Command to start kweb server: jupyter run jupyter_kweb.py

joamatab commented 1 year ago

how about using gf web?

https://gdsfactory.github.io/gdsfactory/workflow.html#webapp-flow

st4eve commented 1 year ago

how about using gf web?

https://gdsfactory.github.io/gdsfactory/workflow.html#webapp-flow

My gf command is currently mapped to git fetch. Does gf web just run the command in the makefile uvicorn main:app --reload. Using this method all I would need to do is make a PDK using all of our chips gds files and the amf layerstack?

joamatab commented 1 year ago

yes, it does

joamatab commented 1 year ago

You can run Gf web --pdk amf

jan-david-fischbach commented 1 year ago

how about using gf web? https://gdsfactory.github.io/gdsfactory/workflow.html#webapp-flow

My gf command is currently mapped to git fetch. Does gf web just run the command in the makefile uvicorn main:app --reload. Using this method all I would need to do is make a PDK using all of our chips gds files and the amf layerstack?

@joamatab if this mapping is common (which I don't know) we might also provide an alias like gdsfactory web to allow usage even with the mapping gf -> git fetch in place

github-actions[bot] commented 1 year ago

This issue is stale because it has been inactive for 60 days. Remove stale label or comment or this will be closed in 7 days.