tidy3d.DiffractionData#
- class DiffractionData[source]#
Bases:
AbstractFieldProjectionData
Data for a
DiffractionMonitor
: complex components of diffracted far fields.- Parameters:
monitor (Attribute:
monitor
) –Type
DiffractionMonitor
Default
Description
Diffraction monitor associated with the data.
Er (Attribute:
Er
) –Type
DiffractionDataArray
Default
Description
Spatial distribution of r-component of the electric field.
Etheta (Attribute:
Etheta
) –Type
DiffractionDataArray
Default
Description
Spatial distribution of the theta-component of the electric field.
Ephi (Attribute:
Ephi
) –Type
DiffractionDataArray
Default
Description
Spatial distribution of phi-component of the electric field.
Hr (Attribute:
Hr
) –Type
DiffractionDataArray
Default
Description
Spatial distribution of r-component of the magnetic field.
Htheta (Attribute:
Htheta
) –Type
DiffractionDataArray
Default
Description
Spatial distribution of theta-component of the magnetic field.
Hphi (Attribute:
Hphi
) –Type
DiffractionDataArray
Default
Description
Spatial distribution of phi-component of the magnetic field.
medium (Attribute:
medium
) –Type
Union[Medium, AnisotropicMedium, PECMedium, PoleResidue, Sellmeier, Lorentz, Debye, Drude, FullyAnisotropicMedium, CustomMedium, CustomPoleResidue, CustomSellmeier, CustomLorentz, CustomDebye, CustomDrude, CustomAnisotropicMedium, PerturbationMedium, PerturbationPoleResidue, Medium2D]
Default
= Medium(nameNone, frequency_rangeNone, allow_gainFalse, nonlinear_specNone, modulation_specNone, heat_specNone, type’Medium’, permittivity1.0, conductivity0.0)
Description
Background medium through which to project fields.
sim_size (Attribute:
sim_size
) –Type
Tuple[float, float]
Default
Units
um
Description
Size of the near field in the local x and y directions.
bloch_vecs (Attribute:
bloch_vecs
) –Type
Tuple[float, float]
Default
Description
Bloch vectors along the local x and y directions in units of
2 * pi / (simulation size along the respective dimension)
.
Example
>>> from tidy3d import DiffractionDataArray >>> f = np.linspace(1e14, 2e14, 10) >>> orders_x = list(range(-4, 5)) >>> orders_y = list(range(-6, 7)) >>> pol = ["s", "p"] >>> coords = dict(orders_x=orders_x, orders_y=orders_y, f=f) >>> values = (1+1j) * np.random.random((len(orders_x), len(orders_y), len(f))) >>> field = DiffractionDataArray(values, coords=coords) >>> monitor = DiffractionMonitor( ... center=(1,2,3), size=(np.inf,np.inf,0), freqs=f, name='diffraction' ... ) >>> data = DiffractionData( ... monitor=monitor, sim_size=[1,1], bloch_vecs=[1,2], ... Etheta=field, Ephi=field, Er=field, ... Htheta=field, Hphi=field, Hr=field, ... )
Attributes
Complex power amplitude in each order for 's' and 'p' polarizations, normalized so that the power carried by the wave of that order and polarization equals
abs(amps)^2
.The (theta, phi) angles corresponding to each allowed pair of diffraction orders storeds as data arrays.
Coordinates grid for the fields in the spherical system.
Get all field components in Cartesian coordinates relative to the monitor's local origin for all allowed diffraction orders and frequencies specified in the
DiffractionMonitor
.Get all field components in spherical coordinates relative to the monitor's local origin for all allowed diffraction orders and frequencies specified in the
DiffractionMonitor
.Allowed orders along x.
Allowed orders along y.
Total power in each order, summed over both polarizations.
Get the normalized "ux" and "uy" reciprocal vectors.
Normalized wave vector along x relative to
local_origin
and oriented with respect tomonitor.normal_dir
, normalized by the wave number in the projection medium.Normalized wave vector along y relative to
local_origin
and oriented with respect tomonitor.normal_dir
, normalized by the wave number in the projection medium.Methods
compute_angles
(reciprocal_vectors)Compute the polar and azimuth angles associated with the given reciprocal vectors.
reciprocal_coords
(orders, size, bloch_vec, ...)Get the normalized "u" reciprocal coords for a vector of orders, size, and bloch vec.
shifted_orders
(orders, bloch_vec)Diffraction orders shifted by the Bloch vector.
- monitor#
- Er#
- Etheta#
- Ephi#
- Hr#
- Htheta#
- Hphi#
- sim_size#
- bloch_vecs#
- static reciprocal_coords(orders, size, bloch_vec, f, medium)[source]#
Get the normalized “u” reciprocal coords for a vector of orders, size, and bloch vec.
- static compute_angles(reciprocal_vectors)[source]#
Compute the polar and azimuth angles associated with the given reciprocal vectors.
- property coords_spherical#
Coordinates grid for the fields in the spherical system.
- property orders_x#
Allowed orders along x.
- property orders_y#
Allowed orders along y.
- property reciprocal_vectors#
Get the normalized “ux” and “uy” reciprocal vectors.
- property ux#
Normalized wave vector along x relative to
local_origin
and oriented with respect tomonitor.normal_dir
, normalized by the wave number in the projection medium.
- property uy#
Normalized wave vector along y relative to
local_origin
and oriented with respect tomonitor.normal_dir
, normalized by the wave number in the projection medium.
- property angles#
The (theta, phi) angles corresponding to each allowed pair of diffraction orders storeds as data arrays. Disallowed angles are set to
np.nan
.
- property amps#
Complex power amplitude in each order for ‘s’ and ‘p’ polarizations, normalized so that the power carried by the wave of that order and polarization equals
abs(amps)^2
.
- property power#
Total power in each order, summed over both polarizations.
- property fields_spherical#
Get all field components in spherical coordinates relative to the monitor’s local origin for all allowed diffraction orders and frequencies specified in the
DiffractionMonitor
.- Returns:
xarray dataset containing (
Er
,Etheta
,Ephi
,Hr
,Htheta
,Hphi
) in spherical coordinates.- Return type:
xarray.Dataset
- property fields_cartesian#
Get all field components in Cartesian coordinates relative to the monitor’s local origin for all allowed diffraction orders and frequencies specified in the
DiffractionMonitor
.- Returns:
xarray dataset containing (
Ex
,Ey
,Ez
,Hx
,Hy
,Hz
) in Cartesian coordinates.- Return type:
xarray.Dataset
- __hash__()#
Hash method.