tidy3d.FieldData#
- class FieldData[source]#
Bases:
FieldDataset
,ElectromagneticFieldData
Data associated with a
FieldMonitor
: scalar components of E and H fields.- Parameters:
Ex (Attribute:
Ex
) βType
Optional[ScalarFieldDataArray]
Default
= None
Description
Spatial distribution of the x-component of the electric field.
Ey (Attribute:
Ey
) βType
Optional[ScalarFieldDataArray]
Default
= None
Description
Spatial distribution of the y-component of the electric field.
Ez (Attribute:
Ez
) βType
Optional[ScalarFieldDataArray]
Default
= None
Description
Spatial distribution of the z-component of the electric field.
Hx (Attribute:
Hx
) βType
Optional[ScalarFieldDataArray]
Default
= None
Description
Spatial distribution of the x-component of the magnetic field.
Hy (Attribute:
Hy
) βType
Optional[ScalarFieldDataArray]
Default
= None
Description
Spatial distribution of the y-component of the magnetic field.
Hz (Attribute:
Hz
) βType
Optional[ScalarFieldDataArray]
Default
= None
Description
Spatial distribution of the z-component of the magnetic field.
monitor (Attribute:
monitor
) βType
FieldMonitor
Default
Description
Frequency-domain field monitor associated with the data.
symmetry (Attribute:
symmetry
) βType
Tuple[Literal[0, -1, 1], Literal[0, -1, 1], Literal[0, -1, 1]]
Default
= (0, 0, 0)
Description
Symmetry eigenvalues of the original simulation in x, y, and z.
symmetry_center (Attribute:
symmetry_center
) βType
Optional[Tuple[float, float, float]]
Default
= None
Description
Center of the symmetry planes of the original simulation in x, y, and z. Required only if any of the
symmetry
field are non-zero.grid_expanded (Attribute:
grid_expanded
) βType
Optional[Grid]
Default
= None
Description
Grid
discretization 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 and flux.grid_primal_correction (Attribute:
grid_primal_correction
) βType
Union[float, FreqDataArray, TimeDataArray, FreqModeDataArray]
Default
= 1.0
Description
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 (Attribute:
grid_dual_correction
) βType
Union[float, FreqDataArray, TimeDataArray, FreqModeDataArray]
Default
= 1.0
Description
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
, andHz
.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
CustomFieldSource
from the fields stored in theFieldData
.- 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
CustomFieldSource
from the fields stored in theFieldData
.- 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.