{
  "title": "Structure",
  "public_path": "flex_rf.tidy3d.Structure",
  "lookup_path": "tidy3d.Structure",
  "slug": "flex_rf/tidy3d/Structure",
  "public_url": "/rf/latest/autogenerated/flex_rf/tidy3d/structure/",
  "object_kind": "class",
  "introduction": "Defines a physical object that interacts with the electromagnetic fields.\nA `Structure` is a combination of a material property (`AbstractMedium`)\nand a `Geometry`.",
  "notes": "Structures can indeed be larger than the simulation domain in `tidy3d`. In such cases, `tidy3d` will\n    automatically truncate the geometry that goes beyond the domain boundaries. For best results, structures that\n    intersect with absorbing boundaries or simulation edges should extend all the way through. In many such\n    cases, an “infinite” size `inf` can be used to define the size along that dimension.\n\n**Practical Advice**\n\nFor example, a waveguide extending along `x` should use `td.inf` to ensure it passes fully through\nPML regions:\n\n```python\nwaveguide = Structure(\n    geometry=Box(center=(0, 0, 0), size=(td.inf, 0.5, 0.22)),\n    medium=Medium(permittivity=3.48**2),\n)\n```\n\nStructures that terminate inside PML can cause evanescent fields at the interface to be amplified\nby the absorber, potentially leading to simulation divergence.\n\nFor uniform pixelated design regions (e.g. topology optimization), use the convenience method\n`from_permittivity_array`, which creates a `Structure` with a `CustomMedium`\nfrom a 3D numpy array of permittivity values and a geometry defining the region:\n\n```python\ndesign_region = td.Box(center=(0, 0, 0), size=(2, 2, 0.22))\nstructure = Structure.from_permittivity_array(\n    geometry=design_region, eps_data=eps_array\n)\n```",
  "examples": "```python\nfrom tidy3d import Box, Medium\nbox = Box(center=(0,0,1), size=(2, 2, 2))\nglass = Medium(permittivity=3.9)\nstruct = Structure(geometry=box, medium=glass, name='glass_box')\n```",
  "references": "",
  "signature": "class Structure(AbstractStructure)",
  "source": {
    "path": "flex/public/tidy3d/tidy3d/components/structure.py",
    "url": "",
    "lineno": 337,
    "endlineno": 1029
  },
  "bases": [
    "AbstractStructure"
  ],
  "parameter_rows": [
    {
      "name": "medium",
      "annotation": "StructureMediumType",
      "default": "",
      "description": "Defines the electromagnetic properties of the structure's medium.",
      "origin": "declared"
    },
    {
      "name": "attrs",
      "annotation": "dict",
      "default": "factory: dict",
      "description": "Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields, `attrs` are mutable. For example, the following is allowed for setting an `attr` `obj.attrs['foo'] = bar`. Also note that Tidy3D will raise a `TypeError` if `attrs` contain objects that can not be serialized. One can check if `attrs` are serializable by calling `obj.model_dump_json()`.",
      "origin": "inherited"
    },
    {
      "name": "geometry",
      "annotation": "GeometryType",
      "default": "",
      "description": "Defines geometric properties of the structure.",
      "origin": "inherited"
    },
    {
      "name": "name",
      "annotation": "str | None",
      "default": "None",
      "description": "Optional name for the structure.",
      "origin": "inherited"
    },
    {
      "name": "background_permittivity",
      "annotation": "float | None",
      "default": "None",
      "description": "DEPRECATED: Use `Structure.background_medium`. Relative permittivity used for the background of this structure when performing shape optimization with autograd.",
      "origin": "inherited"
    },
    {
      "name": "background_medium",
      "annotation": "StructureMediumType | None",
      "default": "None",
      "description": "Medium used for the background of this structure when performing shape optimization with autograd. This is required when the structure is embedded in another structure as autograd will use the permittivity of the `Simulation` by default to compute the shape derivatives.",
      "origin": "inherited"
    },
    {
      "name": "priority",
      "annotation": "int | None",
      "default": "None",
      "description": "Priority of the structure applied in structure overlapping region. The material property in the overlapping region is dictated by the structure of higher priority. For structures of equal priority, the structure added later to the structure list takes precedence. When `priority` is None, the value is automatically assigned based on `structure_priority_mode` in the `Simulation`.",
      "origin": "inherited"
    }
  ],
  "members": [
    {
      "name": "eps_comp",
      "kind": "function",
      "signature": "eps_comp(row: Axis, col: Axis, frequency: float, coords: Coords)",
      "description": "Single component of the complex-valued permittivity tensor as a function of frequency."
    },
    {
      "name": "eps_diagonal",
      "kind": "function",
      "signature": "eps_diagonal(frequency: float, coords: Coords)",
      "description": "Main diagonal of the complex-valued permittivity tensor as a function of frequency."
    },
    {
      "name": "from_permittivity_array",
      "kind": "function",
      "signature": "from_permittivity_array(geometry: GeometryType, eps_data: np.ndarray, **kwargs: Any)",
      "description": "Create `Structure` with `geometry` and `CustomMedium` containing `eps_data` for The `permittivity` field. Extra keyword arguments are passed to `td.Structure()`."
    },
    {
      "name": "list_from_custom_medium",
      "kind": "function",
      "signature": "list_from_custom_medium(*, medium: AbstractCustomMedium, slab_bounds: tuple[float, float] | None = None, axis: int | None = None, frequency: float | None = None, threshold: float | None = None, foreground_medium: StructureMediumType | None = None, background_medium: StructureMediumType | None = None, pixel_exact: bool = False, boundary_step: float | None = None, smooth_sigma: float = 0.0, min_hole_area: float = 0.0, min_island_area: float = 0.0, name_prefix: str = 'design_polyslab')",
      "description": "Create structures from a thresholded 2D slice of a custom medium."
    },
    {
      "name": "list_from_dataarray",
      "kind": "function",
      "signature": "list_from_dataarray(*, data: SpatialDataArray, slab_bounds: tuple[float, float] | None = None, axis: int | None = None, threshold: float | None = None, foreground_medium: StructureMediumType | None = None, background_medium: StructureMediumType | None = None, pixel_exact: bool = False, boundary_step: float | None = None, smooth_sigma: float = 0.0, min_hole_area: float = 0.0, min_island_area: float = 0.0, name_prefix: str = 'design_polyslab')",
      "description": "Create structures from a permittivity data array."
    },
    {
      "name": "to_gds",
      "kind": "function",
      "signature": "to_gds(cell: gdstk.Cell, x: float | None = None, y: float | None = None, z: float | None = None, permittivity_threshold: NonNegativeFloat = 1, frequency: PositiveFloat = 0, gds_layer: NonNegativeInt = 0, gds_dtype: NonNegativeInt = 0, pixel_exact: bool = False)",
      "description": "Append a structure's planar slice to a .gds cell."
    },
    {
      "name": "to_gds_file",
      "kind": "function",
      "signature": "to_gds_file(fname: PathLike, x: float | None = None, y: float | None = None, z: float | None = None, permittivity_threshold: NonNegativeFloat = 1, frequency: PositiveFloat = 0, gds_layer: NonNegativeInt = 0, gds_dtype: NonNegativeInt = 0, gds_cell_name: str = 'MAIN', pixel_exact: bool = False)",
      "description": "Export a structure's planar slice to a .gds file."
    },
    {
      "name": "to_gdstk",
      "kind": "function",
      "signature": "to_gdstk(x: float | None = None, y: float | None = None, z: float | None = None, permittivity_threshold: NonNegativeFloat = 1, frequency: PositiveFloat = 0, gds_layer: NonNegativeInt = 0, gds_dtype: NonNegativeInt = 0, pixel_exact: bool = False)",
      "description": "Convert a structure's planar slice to a .gds type polygon."
    },
    {
      "name": "viz_spec",
      "kind": "attribute",
      "signature": "viz_spec: VisualizationSpec | None",
      "description": ""
    }
  ],
  "group": "flex_rf.tidy3d"
}
