gplugins

raw JSON →
2.0.1 verified Fri May 01 auth: no python

Plugins for gdsfactory, a Python library for photonic chip design. Provides simulation (meep, tidy3d), netlist extraction, and DFM checks. Current stable version: 2.0.1, release cadence is irregular. Requires Python >=3.11.

pip install gplugins
error ModuleNotFoundError: No module named 'gplugins.meep'
cause Installed an older version of gplugins (<2.0) where submodules were not organized under 'gplugins.meep'.
fix
Upgrade to gplugins >=2.0: pip install --upgrade gplugins
error NameError: name 'meep' is not defined
cause Used `import gplugins.meep` without an alias, then tried to call meep functions directly.
fix
Use import gplugins.meep as gm and call gm.write_sparameters_meep(...)
error FileNotFoundError: [Errno 2] No such file or directory: 'temp.gds'
cause The component does not have an associated GDS file, and simulation routines require one.
fix
Write the component to a GDS file first: c.write_gds('temp.gds') then pass the component.
breaking Version 2.0.0 renamed all submodules (e.g., 'meep' became 'gplugins.meep') and removed top-level imports. Old code using `from gplugins import *` or `import gplugins.meep as meep` will break.
fix Update imports: `import gplugins.meep as gm` instead of `from gplugins import meep`. Use submodule-specific aliases.
gotcha The `write_sparameters_meep` function requires the component to be a full path to a GDS file or a Component with a GDS file written. In-memory components not written to file cause silent errors.
fix Call `c.write_gds('temp.gds')` before simulation or provide a component that is already linked to a file.
gotcha Tidy3d plugin requires an API key set via `TIDY3D_API_KEY` environment variable or tidy3d config. Simulation will fail with a vague authentication error if missing.
fix Set environment variable `TIDY3D_API_KEY` or configure tidy3d via `tidy3d.config.api_key = '...'` before using the plugin.

Basic meep simulation using gplugins. Requires gdsfactory and meep installed.

import gdsfactory as gf
import gplugins.meep as gm

c = gf.c.straight_heater_metal(length=5, width=0.5)

# Simulate using meep
sim_settings = {
    "resolution": 20,
    "wavelength": 1.55,
    "duration": 1e-12,
}
gm.write_sparameters_meep(c, filepath="sparams.h5", **sim_settings)