Cannot import name 'fuse_polygons'

I am trying to run the notebook provided in this tutorial, but I am running into the import error below.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[4], line 5
      2 import matplotlib.pyplot as plt
      3 import numpy as np
----> 5 from gplugins.devsim import get_simulation_xsection
      6 from gplugins.devsim.get_simulation_xsection import k_to_alpha
      8 gf.config.rich_output()

File ~\AppData\Local\anaconda3\envs\pic_devsim\Lib\site-packages\gplugins\devsim\__init__.py:14
      4 from gdsfactory.config import logger
      6 from gplugins.devsim.get_simulation_xsection import (
      7     PINWaveguide,
      8     alpha_to_k,
   (...)
     12     k_to_alpha,
     13 )
---> 14 from gplugins.devsim.get_solver import DDComponent
     16 logger.info(f"DEVSIM {tcad.__version__!r} installed at {tcad.__path__!r}")
     18 __all__ = [
     19     "dn_carriers",
     20     "dalpha_carriers",
   (...)
     25     "clear_devsim_cache",
     26 ]

File ~\AppData\Local\anaconda3\envs\pic_devsim\Lib\site-packages\gplugins\devsim\get_solver.py:30
     24 from pydantic import Extra
     26 from gplugins.devsim.doping import (
     27     DopingLayerLevel,
     28     get_doping_info_generic,
     29 )
---> 30 from gplugins.devsim.get_simulation import create_2Duz_simulation
     33 def set_universal_parameters(device, region) -> None:
     34     universal = {
     35         "q": 1.6e-19,  # , 'coul'),
     36         "k": 1.3806503e-23,  # , 'J/K'),
     37         "Permittivity_0": 8.85e-14,  # , 'F/cm^2')
     38     }

File ~\AppData\Local\anaconda3\envs\pic_devsim\Lib\site-packages\gplugins\devsim\get_simulation.py:23
     20 from scipy.interpolate import NearestNDInterpolator
     22 from gplugins.devsim.doping import get_doping_info_generic
---> 23 from gplugins.gmsh import (
     24     fuse_polygons,
     25     get_u_bounds_polygons,
     26     uz_xsection_mesh,
     27 )
     29 um_to_cm = 1e-4
     32 def create_2Duz_simulation(
     33     component: Component,
     34     xsection_bounds: tuple[tuple[float, float], tuple[float, float]],
   (...)
     50 ):
     51     # Replace relevant physical entities by contacts

ImportError: cannot import name 'fuse_polygons' from 'gplugins.gmsh' (C:\Users\username\AppData\Local\anaconda3\envs\pic_devsim\Lib\site-packages\gplugins\gmsh\__init__.py)

Hi @samuelkim

Thanks for trying out devsim. I did not write this notebook, so I don’t know how it works. Perhaps you can ask at the project website:

Or perhaps @simbilod may know?

1 Like

Hi @samuelkim

I am the author of this notebook :slight_smile:

I do personally use the gdsfactory gmsh integration to generate meshes from layouts that I then simulate with DEVSIM.

That specific notebook, however, is severely outdated, to the point that I think it is best to retire it for now, see retire devsim doc by simbilod · Pull Request #296 · gdsfactory/gplugins · GitHub

I can provide better examples in the coming days

2 Likes

HI @simbilod

Thanks for the updates. I really need to start taking a look at the gdsfactory/devsim integration.

For what it’s worth, there is now a reset_devsim command, making it much easier to integrate it with a notebook or long running process.
https://devsim.net/CommandReference.html#devsim.reset_devsim

Regards,

Juan

1 Like