tidy3d.ModeAmpsData#

class tidy3d.ModeAmpsData#

Stores modal amplitdudes from a ModeMonitor.

Parameters
  • values (Array) – Multi-dimensional array storing the raw, complex mode amplitude values.

  • data_attrs (Mapping[str, str] = {'units': 'sqrt(W)', 'long_name': 'mode amplitudes'}) – Dictionary storing extra attributes associated with the monitor data.

  • f (Array) – [units = Hz]. Array of frequency values to use as coordintes.

  • mode_index (Array) – Array of mode index values to use as coordintes.

  • direction (List[Literal['+', '-']] = ['+', '-']) – List of directions contained in the mode amplitude data.

Example

>>> f = np.linspace(2e14, 3e14, 1001)
>>> mode_index = np.arange(1, 3)
>>> values = (1+1j) * np.random.random((2, len(f), len(mode_index)))
>>> data = ModeAmpsData(values=values, direction=['+', '-'], mode_index=mode_index, f=f)

Show JSON schema
{
   "title": "ModeAmpsData",
   "description": "Stores modal amplitdudes from a :class:`.ModeMonitor`.\n\nParameters\n----------\nvalues : Array\n    Multi-dimensional array storing the raw, complex mode amplitude values.\ndata_attrs : Mapping[str, str] = {'units': 'sqrt(W)', 'long_name': 'mode amplitudes'}\n    Dictionary storing extra attributes associated with the monitor data.\nf : Array\n    [units = Hz].  Array of frequency values to use as coordintes.\nmode_index : Array\n    Array of mode index values to use as coordintes.\ndirection : List[Literal['+', '-']] = ['+', '-']\n    List of directions contained in the mode amplitude data.\n\nExample\n-------\n>>> f = np.linspace(2e14, 3e14, 1001)\n>>> mode_index = np.arange(1, 3)\n>>> values = (1+1j) * np.random.random((2, len(f), len(mode_index)))\n>>> data = ModeAmpsData(values=values, direction=['+', '-'], mode_index=mode_index, f=f)",
   "type": "object",
   "properties": {
      "type": {
         "title": "Type",
         "default": "ModeAmpsData",
         "enum": [
            "ModeAmpsData"
         ],
         "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.",
         "default": {
            "units": "sqrt(W)",
            "long_name": "mode amplitudes"
         },
         "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"
         ]
      },
      "direction": {
         "title": "Direction Coordinates",
         "description": "List of directions contained in the mode amplitude data.",
         "default": [
            "+",
            "-"
         ],
         "type": "array",
         "items": {
            "enum": [
               "+",
               "-"
            ],
            "type": "string"
         }
      }
   },
   "required": [
      "values",
      "f",
      "mode_index"
   ]
}

Fields
  • data_attrs (Dict[str, str])

  • direction (List[Literal['+', '-']])

  • values (tidy3d.components.types.Array)

attribute data_attrs: Dict[str, str] = {'long_name': 'mode amplitudes', 'units': 'sqrt(W)'}#

explanation of values values is a numpy array that stores the raw data associated with each MonitorData. It can be complex-valued or real valued, depending on whether data is in the frequency or time domain, respectively. Each axis in values corresponds to a specific dimension in the MonitorData, which are supplied as arguments to the MonitorData subclasses. The order of the dimensions is specified in the _dims attribute of each MonitorData subclass

Dictionary storing extra attributes associated with the monitor data.

attribute direction: List[Literal['+', '-']] = ['+', '-']#

List of directions contained in the mode amplitude data.

attribute values: tidy3d.components.types.Array [Required]#

Multi-dimensional array storing the raw, complex mode amplitude values.

Constraints
  • 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’]

normalize(source_freq_amps: tidy3d.components.types.Array) None#

normalize the values by the amplitude of the source.