Skip to content

flex_rf.tidy3d.FieldData

Type: class Base(s): FieldDataset, ElectromagneticFieldData

Data associated with a FieldMonitor: scalar components of E and H fields.

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.

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)

.. TODO sort out standalone data example.

monitor [FieldMonitor]

Frequency-domain field monitor associated with the data.

Ex [ScalarFieldDataArray | None] = None

Spatial distribution of the x-component of the electric field.

Ey [ScalarFieldDataArray | None] = None

Spatial distribution of the y-component of the electric field.

Ez [ScalarFieldDataArray | None] = None

Spatial distribution of the z-component of the electric field.

Hx [ScalarFieldDataArray | None] = None

Spatial distribution of the x-component of the magnetic field.

Hy [ScalarFieldDataArray | None] = None

Spatial distribution of the y-component of the magnetic field.

Hz [ScalarFieldDataArray | None] = None

Spatial distribution of the z-component of the magnetic field.

symmetry [tuple[Symmetry, Symmetry, Symmetry]] = (0, 0, 0)

Symmetry eigenvalues of the original simulation in x, y, and z.

symmetry_center [Coordinate | None] = None

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 [Grid | None] = None

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 vector and flux.

grid_primal_correction [GRID_CORRECTION_TYPE] = 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 [GRID_CORRECTION_TYPE] = 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.

normalize(source_spectrum_fn: Callable[[float], complex])

Return copy of self after normalization is applied using source spectrum function.

to_source(source_time: SourceTimeType, center: Coordinate, size: Size = None, **kwargs: Any)

Create a CustomFieldSource from the fields stored in the FieldData.