tidy3d.ModeData
tidy3d.ModeData#
- class tidy3d.ModeData#
Stores a collection of mode decomposition amplitudes and mode effective indexes for all modes in a
ModeMonitor
.- Parameters
data_dict (Mapping[str, Union[ModeAmpsData, ModeIndexData]]) – Mapping of ‘amps’ to
ModeAmpsData
and ‘n_complex’ toModeIndexData
for theModeMonitor
.
Example
>>> f = np.linspace(1e14, 2e14, 1001) >>> mode_index = np.arange(2) >>> amps = (1+1j) * np.random.random((2, len(f), len(mode_index))) >>> amps_data = ModeAmpsData(values=amps, f=f, mode_index=mode_index) >>> n_complex = (1+1j) * np.random.random((len(f), len(mode_index))) >>> index_data = ModeIndexData(values=n_complex, f=f, mode_index=mode_index) >>> data = ModeData(data_dict={'n_complex': index_data, 'amps': amps_data})
Show JSON schema
{ "title": "ModeData", "description": "Stores a collection of mode decomposition amplitudes and mode effective indexes for all\nmodes in a :class:`.ModeMonitor`.\n\nParameters\n----------\ndata_dict : Mapping[str, Union[ModeAmpsData, ModeIndexData]]\n Mapping of 'amps' to :class:`.ModeAmpsData` and 'n_complex' to :class:`.ModeIndexData` for the :class:`.ModeMonitor`.\n\nExample\n-------\n>>> f = np.linspace(1e14, 2e14, 1001)\n>>> mode_index = np.arange(2)\n>>> amps = (1+1j) * np.random.random((2, len(f), len(mode_index)))\n>>> amps_data = ModeAmpsData(values=amps, f=f, mode_index=mode_index)\n>>> n_complex = (1+1j) * np.random.random((len(f), len(mode_index)))\n>>> index_data = ModeIndexData(values=n_complex, f=f, mode_index=mode_index)\n>>> data = ModeData(data_dict={'n_complex': index_data, 'amps': amps_data})", "type": "object", "properties": { "type": { "title": "Type", "default": "ModeData", "enum": [ "ModeData" ], "type": "string" }, "data_dict": { "title": "Data Dictionary", "description": "Mapping of 'amps' to :class:`.ModeAmpsData` and 'n_complex' to :class:`.ModeIndexData` for the :class:`.ModeMonitor`.", "type": "object", "additionalProperties": { "anyOf": [ { "$ref": "#/definitions/ModeAmpsData" }, { "$ref": "#/definitions/ModeIndexData" } ] } } }, "required": [ "data_dict" ], "definitions": { "ModeAmpsData": { "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" ] }, "ModeIndexData": { "title": "ModeIndexData", "description": "Stores effective propagation index from a :class:`.ModeMonitor`.\n\nParameters\n----------\nvalues : Array\n Values of the mode's complex effective refractive index.\ndata_attrs : Mapping[str, str] = {'units': '', 'long_name': 'effective index'}\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.\n\nExample\n-------\n>>> f = np.linspace(2e14, 3e14, 1001)\n>>> values = (1+1j) * np.random.random((len(f), 2))\n>>> data = ModeIndexData(values=values, mode_index=np.arange(1, 3), f=f)", "type": "object", "properties": { "type": { "title": "Type", "default": "ModeIndexData", "enum": [ "ModeIndexData" ], "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": "", "long_name": "effective index" }, "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" ] } }, "required": [ "values", "f", "mode_index" ] } } }
- Fields
data_dict (Dict[str, Union[tidy3d.components.data.ModeAmpsData, tidy3d.components.data.ModeIndexData]])
- attribute data_dict: Dict[str, Union[tidy3d.components.data.ModeAmpsData, tidy3d.components.data.ModeIndexData]] [Required]#
Mapping of ‘amps’ to
ModeAmpsData
and ‘n_complex’ toModeIndexData
for theModeMonitor
.
- property amps#
Get mode amplitudes.
- property k_eff#
Get imaginary part of effective index.
- property n_complex#
Get complex effective indexes.
- property n_eff#
Get real part of effective index.