gdsfactory / gplugins

gdsfactory plugins

Home Page:https://gdsfactory.github.io/gplugins/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unable to import gmeep

joreb opened this issue · comments

commented

Dear Sir ,

I posting this because I am encountering difficulties while attempting to import the gmeep library for a scattering parameter simulation using Gdsfactory and Meep.

I have included the relevant code snippet below:

import gdsfactory as gf
import matplotlib.pyplot as plt
import numpy as np
from autograd import tensor_jacobian_product
from gdsfactory.generic_tech import get_generic_pdk
from meep import MaterialGrid, Medium, Vector3, Volume
from meep.adjoint import (
    DesignRegion,
    get_conic_radius_from_eta_e,
)


import gplugins
import gplugins.gmeep as gm
gf.config.rich_output()
PDK = get_generic_pdk()
PDK.activate()

The issue arises during the import statement: there seems to be a recursive call here.

----> [2] import gplugins.gmeep as gm
---> [18] from gplugins.gmeep.write_sparameters_grating import (
       [19] write_sparameters_grating,
       [20] write_sparameters_grating_batch,
       [21] write_sparameters_grating_mpi,
       [22])

PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <class 'kfactory.kcell.KCell'>. Set `arbitrary_types_allowed=True` in the model_config to ignore this error or implement `__get_pydantic_core_schema__` on your type to fully support it.

If you got this error by calling handler(<some type>) within `__get_pydantic_core_schema__` then you likely need to call `handler.generate_schema(<some type>)` since we do not call `__get_pydantic_core_schema__` on `<some type>` otherwise to avoid infinite recursion

I am unable to successfully import the gmeep library. I would greatly appreciate any suggestions or guidance you could offer to resolve this import error.

Thank you for your time and assistance.

commented

This is addressed in #437