tidy3d.ModeFieldData#

class tidy3d.ModeFieldData#

Like FieldData but with extra dimension mode_index.

Parameters
  • data_dict (Mapping[str, ScalarModeFieldData] = None) – Mapping of field name to the corresponding ScalarModeFieldData.

  • symmetry (Tuple[Literal[0, -1, 1], Literal[0, -1, 1], Literal[0, -1, 1]] = (0, 0, 0)) – igenvalues of the symmetry under reflection in x, y, and z.

  • symmetry_center (Optional[Tuple[float, float, float]] = None) – Position of the symmetry planes in x, y, and z.

  • expanded_grid (Mapping[str, Coords] = {}) – Grid after the symmetries (if any) are expanded. The dictionary keys must correspond to the data keys in the data_dict for the expanded grid to be invoked.

Example

>>> f = np.linspace(1e14, 2e14, 1001)
>>> x = np.linspace(-1, 1, 10)
>>> y = np.linspace(-2, 2, 20)
>>> z = np.linspace(0, 0, 1)
>>> mode_index = np.arange(0, 4)
>>> values = (1+1j) * np.random.random((len(x), len(y), len(z), len(f), len(mode_index)))
>>> field = ScalarModeFieldData(values=values, x=x, y=y, z=z, f=f, mode_index=mode_index)
>>> data = ModeFieldData(data_dict={'Ex': field, 'Ey': field})

Show JSON schema
{
   "title": "ModeFieldData",
   "description": "Like FieldData but with extra dimension ``mode_index``.\n\nParameters\n----------\ndata_dict : Mapping[str, ScalarModeFieldData] = None\n    Mapping of field name to the corresponding :class:`.ScalarModeFieldData`.\nsymmetry : Tuple[Literal[0, -1, 1], Literal[0, -1, 1], Literal[0, -1, 1]] = (0, 0, 0)\n    igenvalues of the symmetry under reflection in x, y, and z.\nsymmetry_center : Optional[Tuple[float, float, float]] = None\n    Position of the symmetry planes in x, y, and z.\nexpanded_grid : Mapping[str, Coords] = {}\n    Grid after the symmetries (if any) are expanded. The dictionary keys must correspond to the data keys in the ``data_dict`` for the expanded grid to be invoked.\n\n\nExample\n-------\n>>> f = np.linspace(1e14, 2e14, 1001)\n>>> x = np.linspace(-1, 1, 10)\n>>> y = np.linspace(-2, 2, 20)\n>>> z = np.linspace(0, 0, 1)\n>>> mode_index = np.arange(0, 4)\n>>> values = (1+1j) * np.random.random((len(x), len(y), len(z), len(f), len(mode_index)))\n>>> field = ScalarModeFieldData(values=values, x=x, y=y, z=z, f=f, mode_index=mode_index)\n>>> data = ModeFieldData(data_dict={'Ex': field, 'Ey': field})",
   "type": "object",
   "properties": {
      "type": {
         "title": "Type",
         "default": "ModeFieldData",
         "enum": [
            "ModeFieldData"
         ],
         "type": "string"
      },
      "data_dict": {
         "title": "Data Dictionary",
         "description": "Mapping of field name to the corresponding :class:`.ScalarModeFieldData`.",
         "type": "object",
         "additionalProperties": {
            "$ref": "#/definitions/ScalarModeFieldData"
         }
      },
      "symmetry": {
         "title": "Symmetry Eigenvalues",
         "description": "igenvalues of the symmetry under reflection in x, y, and z.",
         "default": [
            0,
            0,
            0
         ],
         "type": "array",
         "minItems": 3,
         "maxItems": 3,
         "items": [
            {
               "enum": [
                  0,
                  -1,
                  1
               ],
               "type": "integer"
            },
            {
               "enum": [
                  0,
                  -1,
                  1
               ],
               "type": "integer"
            },
            {
               "enum": [
                  0,
                  -1,
                  1
               ],
               "type": "integer"
            }
         ]
      },
      "symmetry_center": {
         "title": "Symmetry Center",
         "description": "Position of the symmetry planes in x, y, and z.",
         "type": "array",
         "minItems": 3,
         "maxItems": 3,
         "items": [
            {
               "type": "number"
            },
            {
               "type": "number"
            },
            {
               "type": "number"
            }
         ]
      },
      "expanded_grid": {
         "title": "Expanded Grid",
         "description": "Grid after the symmetries (if any) are expanded. The dictionary keys must correspond to the data keys in the ``data_dict`` for the expanded grid to be invoked.",
         "default": {},
         "type": "object",
         "additionalProperties": {
            "$ref": "#/definitions/Coords"
         }
      }
   },
   "required": [
      "data_dict"
   ],
   "definitions": {
      "ScalarModeFieldData": {
         "title": "ScalarModeFieldData",
         "description": "Like :class:`.ScalarFieldData`, but with extra dimension ``mode_index``.\n\nParameters\n----------\nvalues : Array = None\n    Multi-dimensional array storing the raw scalar field values in freq. domain.\ndata_attrs : Optional[Mapping[str, str]] = None\n    Dictionary storing extra attributes associated with the monitor data.\nf : Array = None\n    [units = Hz].  Array of frequency values to use as coordintes.\nmode_index : Array = None\n    Array of mode index values to use as coordintes.\nx : Array = None\n    [units = um].  Array of x location values to use as coordintes.\ny : Array = None\n    [units = um].  Array of y location values to use as coordintes.\nz : Array = None\n    [units = um].  Array of z location values to use as coordintes.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "default": "ScalarModeFieldData",
               "enum": [
                  "ScalarModeFieldData"
               ],
               "type": "string"
            },
            "values": {
               "title": "NumpyArray",
               "description": "Wrapper around numpy arrays that has a well defined json schema.",
               "type": "object",
               "properties": {
                  "data_list": {
                     "title": "Data List",
                     "type": "array",
                     "items": {}
                  }
               },
               "required": [
                  "data_list"
               ]
            },
            "data_attrs": {
               "title": "Data Attributes",
               "description": "Dictionary storing extra attributes associated with the monitor data.",
               "type": "object",
               "additionalProperties": {
                  "type": "string"
               }
            },
            "f": {
               "title": "NumpyArray",
               "description": "Wrapper around numpy arrays that has a well defined json schema.",
               "units": "Hz",
               "type": "object",
               "properties": {
                  "data_list": {
                     "title": "Data List",
                     "type": "array",
                     "items": {}
                  }
               },
               "required": [
                  "data_list"
               ]
            },
            "mode_index": {
               "title": "NumpyArray",
               "description": "Wrapper around numpy arrays that has a well defined json schema.",
               "type": "object",
               "properties": {
                  "data_list": {
                     "title": "Data List",
                     "type": "array",
                     "items": {}
                  }
               },
               "required": [
                  "data_list"
               ]
            },
            "x": {
               "title": "NumpyArray",
               "description": "Wrapper around numpy arrays that has a well defined json schema.",
               "units": "um",
               "type": "object",
               "properties": {
                  "data_list": {
                     "title": "Data List",
                     "type": "array",
                     "items": {}
                  }
               },
               "required": [
                  "data_list"
               ]
            },
            "y": {
               "title": "NumpyArray",
               "description": "Wrapper around numpy arrays that has a well defined json schema.",
               "units": "um",
               "type": "object",
               "properties": {
                  "data_list": {
                     "title": "Data List",
                     "type": "array",
                     "items": {}
                  }
               },
               "required": [
                  "data_list"
               ]
            },
            "z": {
               "title": "NumpyArray",
               "description": "Wrapper around numpy arrays that has a well defined json schema.",
               "units": "um",
               "type": "object",
               "properties": {
                  "data_list": {
                     "title": "Data List",
                     "type": "array",
                     "items": {}
                  }
               },
               "required": [
                  "data_list"
               ]
            }
         },
         "required": [
            "values",
            "f",
            "mode_index",
            "x",
            "y",
            "z"
         ]
      },
      "Coords": {
         "title": "Coords",
         "description": "Holds data about a set of x,y,z positions on a grid.\n\nParameters\n----------\nx : Array = None\n    1-dimensional array of x coordinates.\ny : Array = None\n    1-dimensional array of y coordinates.\nz : Array = None\n    1-dimensional array of z coordinates.\n\nExample\n-------\n>>> x = np.linspace(-1, 1, 10)\n>>> y = np.linspace(-1, 1, 11)\n>>> z = np.linspace(-1, 1, 12)\n>>> coords = Coords(x=x, y=y, z=z)",
         "type": "object",
         "properties": {
            "x": {
               "title": "NumpyArray",
               "description": "Wrapper around numpy arrays that has a well defined json schema.",
               "type": "object",
               "properties": {
                  "data_list": {
                     "title": "Data List",
                     "type": "array",
                     "items": {}
                  }
               },
               "required": [
                  "data_list"
               ]
            },
            "y": {
               "title": "NumpyArray",
               "description": "Wrapper around numpy arrays that has a well defined json schema.",
               "type": "object",
               "properties": {
                  "data_list": {
                     "title": "Data List",
                     "type": "array",
                     "items": {}
                  }
               },
               "required": [
                  "data_list"
               ]
            },
            "z": {
               "title": "NumpyArray",
               "description": "Wrapper around numpy arrays that has a well defined json schema.",
               "type": "object",
               "properties": {
                  "data_list": {
                     "title": "Data List",
                     "type": "array",
                     "items": {}
                  }
               },
               "required": [
                  "data_list"
               ]
            },
            "type": {
               "title": "Type",
               "default": "Coords",
               "enum": [
                  "Coords"
               ],
               "type": "string"
            }
         },
         "required": [
            "x",
            "y",
            "z"
         ],
         "additionalProperties": false
      }
   }
}

Fields
  • data_dict (Dict[str, tidy3d.components.data.ScalarModeFieldData])

attribute data_dict: Dict[str, tidy3d.components.data.ScalarModeFieldData] [Required]#

Mapping of field name to the corresponding ScalarModeFieldData.

sel_mode_index(mode_index)#

Return a FieldData at the selected mode index.