GithubHelp home page GithubHelp logo

Comments (6)

joamatab avatar joamatab commented on June 29, 2024

Hi Lucas,

we usually don't mix pya, (the GUI API for klayout) and gf.kdb (the python API)

something klayout does internally to store the metadata from Component.ports, component.info and component.settings is to create a second cell

from gdsfactory.

lukasc-ubc avatar lukasc-ubc commented on June 29, 2024

Hi Joaquin,

I was running this test in VSCode, not in the GUI. I removed the line "import pya". I still get the extra cells. My code did not instantiate the straight and taper cells. So there must be some memory leak or other bug in gdsfactory that is creating these additional cells, and reducing the performance.

from gdsfactory.

joamatab avatar joamatab commented on June 29, 2024

hi Lukas,

this works great for me

import gdsfactory as gf

c = gf.Component()
mmi = c.add_ref(gf.components.mmi1x2())
c.write_gds('/tmp/2.gds')
c.show()

from gdsfactory.

lukasc-ubc avatar lukasc-ubc commented on June 29, 2024

Hi @joamatab

Indeed, there are two ways to save the file:

layout.write('/tmp/1.gds')
c.write_gds('/tmp/2.gds')

The 2nd one works, as shown in the screenshots above. The 1st method works but adds two extra cells.

from gdsfactory.

sebastian-goeldi avatar sebastian-goeldi commented on June 29, 2024

The 2 extra cells can come from double wrapped components

If you do

@gf.cell
def my_straight():
    return gf.c.straight()

The @cell will detect that the initial cell is already locked and create a new one. This is most likely where the extra cells come from.

So indeed c.write_gds is the best approach as the layout/kcl write will all cells in the layout. You can selectively exclude within the save_options though

from gdsfactory.

sebastian-goeldi avatar sebastian-goeldi commented on June 29, 2024

Also, please be aware, if you resort to layout().write(...) etc, you are circumventing a lot of gdsfactory sanitory checks as well as dropping (most if not all) meta infos and therefore will not be able to use any operation relying on read and reconstructed meta info such as http://sami.klayout.org/preview?url=git%2Bhttps%3A%2F%2Fgithub.com%2Fgdsfactory%2Fmetainfo-ports.git%2Bklayout%5Bv0.0.6%5D or when reading gds files into gdsfactory again.

The proper gdsfactory operation is write_gds or if pure kfactory gf.kcl.write(...)

from gdsfactory.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.