tidy3d.FieldData#
- class FieldData[source]#
- Bases: - FieldDataset,- ElectromagneticFieldData- Data associated with a - FieldMonitor: scalar components of E and H fields.- Parameters:
- 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] = 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] = 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 - normalize(source_spectrum_fn)- Return copy of self after normalization is applied using source spectrum function. - to_source(source_time,Β center[,Β size])- Create a - CustomFieldSourcefrom the fields stored in the- FieldData.- 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:
 
 - __hash__()#
- Hash method.