# tidy3d.DiffractionData#

class DiffractionData[source]#

Data for a `DiffractionMonitor`: complex components of diffracted far fields.

Parameters:

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

 `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`. `angles` The (theta, phi) angles corresponding to each allowed pair of diffraction orders storeds as data arrays. `coords_spherical` Coordinates grid for the fields in the spherical system. `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`. `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`. `orders_x` Allowed orders along x. `orders_y` Allowed orders along y. `power` Total power in each order, summed over both polarizations. `reciprocal_vectors` Get the normalized "ux" and "uy" reciprocal vectors. `ux` Normalized wave vector along x relative to `local_origin` and oriented with respect to `monitor.normal_dir`, normalized by the wave number in the projection medium. `uy` Normalized wave vector along y relative to `local_origin` and oriented with respect to `monitor.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.

Inherited Common Usage

monitor#
Er#
Etheta#
Ephi#
Hr#
Htheta#
Hphi#
sim_size#
bloch_vecs#
static shifted_orders(orders, bloch_vec)[source]#

Diffraction orders shifted by the Bloch vector.

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 to `monitor.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 to `monitor.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.