tidy3d.FieldData#
- class FieldData[source]#
- Bases: - FieldDataset,- ElectromagneticFieldData- Data associated with a - FieldMonitor: scalar components of E and H fields.- Parameters:
- attrs (dict = {}) β 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, - attrsare mutable. For example, the following is allowed for setting an- attr- obj.attrs['foo'] = bar. Also note that Tidy3D` will raise a- TypeErrorif- attrscontain objects that can not be serialized. One can check if- attrsare serializable by calling- obj.json().
- Ex (Optional[ScalarFieldDataArray] = None) β Spatial distribution of the x-component of the electric field. 
- Ey (Optional[ScalarFieldDataArray] = None) β Spatial distribution of the y-component of the electric field. 
- Ez (Optional[ScalarFieldDataArray] = None) β Spatial distribution of the z-component of the electric field. 
- Hx (Optional[ScalarFieldDataArray] = None) β Spatial distribution of the x-component of the magnetic field. 
- Hy (Optional[ScalarFieldDataArray] = None) β Spatial distribution of the y-component of the magnetic field. 
- Hz (Optional[ScalarFieldDataArray] = None) β Spatial distribution of the z-component of the magnetic field. 
- monitor (FieldMonitor) β Frequency-domain field monitor associated with the data. 
- symmetry (Tuple[Literal[0, -1, 1], Literal[0, -1, 1], Literal[0, -1, 1]] = (0, 0, 0)) β Symmetry eigenvalues of the original simulation in x, y, and z. 
- symmetry_center (Optional[Tuple[float, float, float]] = None) β Center of the symmetry planes of the original simulation in x, y, and z. Required only if any of the - symmetryfield are non-zero.
- grid_expanded (Optional[Grid] = None) β - Griddiscretization of the associated monitor in the simulation which created the data. Required if symmetries are present, as well as in order to use some functionalities like getting Poynting vector and flux.
- grid_primal_correction (Union[float, FreqDataArray, TimeDataArray, FreqModeDataArray, EMEFreqModeDataArray] = 1.0) β Correction factor that needs to be applied for data corresponding to a 2D monitor to take into account the finite grid in the normal direction in the simulation in which the data was computed. The factor is applied to fields defined on the primal grid locations along the normal direction. 
- grid_dual_correction (Union[float, FreqDataArray, TimeDataArray, FreqModeDataArray, EMEFreqModeDataArray] = 1.0) β Correction factor that needs to be applied for data corresponding to a 2D monitor to take into account the finite grid in the normal direction in the simulation in which the data was computed. The factor is applied to fields defined on the dual grid locations along the normal direction. 
 
 - Notes - The data is stored as a DataArray object using the xarray package. - This dataset can contain all electric and magnetic field components: - Ex,- Ey,- Ez,- Hx,- Hy, and- Hz.- Example - >>> from tidy3d import ScalarFieldDataArray >>> x = [-1,1,3] >>> y = [-2,0,2,4] >>> z = [-3,-1,1,3,5] >>> f = [2e14, 3e14] >>> coords = dict(x=x[:-1], y=y[:-1], z=z[:-1], f=f) >>> grid = Grid(boundaries=Coords(x=x, y=y, z=z)) >>> scalar_field = ScalarFieldDataArray((1+1j) * np.random.random((2,3,4,2)), coords=coords) >>> monitor = FieldMonitor( ... size=(2,4,6), freqs=[2e14, 3e14], name='field', fields=['Ex', 'Hz'], colocate=True ... ) >>> data = FieldData(monitor=monitor, Ex=scalar_field, Hz=scalar_field, grid_expanded=grid) - See also - Notebooks:
- Quickstart: Usage in a basic simulation flow. 
 
 - Attributes - Methods - make_adjoint_sources(dataset_names)- Converts a - FieldDatato a list of adjoint current or point sources.- normalize(source_spectrum_fn)- Return copy of self after normalization is applied using source spectrum function. - Create adjoint custom field sources if this field data has some dimensionality. - Create adjoint point dipole source if this field data contains one item. - to_source(source_time,Β center[,Β size])- Create a - CustomFieldSourcefrom the fields stored in the- FieldData.- Inherited Common Usage - monitor#
 - normalize(source_spectrum_fn)[source]#
- Return copy of self after normalization is applied using source spectrum function. 
 - to_source(source_time, center, size=None, **kwargs)[source]#
- Create a - CustomFieldSourcefrom the fields stored in the- FieldData.- Parameters:
- source_time ( - SourceTime) β Specification of the source time-dependence.
- center (Tuple[float, float, float]) β Source center in x, y and z. 
- size (Tuple[float, float, float]) β Source size in x, y, and z. If not provided, the size of the monitor associated to the data is used. 
- **kwargs β Extra keyword arguments passed to - CustomFieldSource.
 
- Returns:
- Source injecting the fields stored in the - FieldData, with other settings as provided in the input arguments.
- Return type:
 
 - make_adjoint_sources(dataset_names)[source]#
- Converts a - FieldDatato a list of adjoint current or point sources.
 - to_adjoint_point_sources()[source]#
- Create adjoint point dipole source if this field data contains one item. 
 - to_adjoint_field_sources()[source]#
- Create adjoint custom field sources if this field data has some dimensionality. 
 - __hash__()#
- Hash method.