tidy3d.FieldProjector#

class FieldProjector[source]#

Bases: _ApproximateAngleProjectionMixin, _ApproximatePairedProjectionMixin, _ExactFieldProjectionMixin, Tidy3dBaseModel

Projection of near fields to points on a given observation grid.

Parameters:
  • sim_data (Optional[SimulationData]) – Container for simulation data containing the near field monitors.

  • surfaces (tuple[FieldProjectionSurface, …]) – tuple of each FieldProjectionSurface to use as source of near field.

  • pts_per_wavelength (Optional[int] = 10) – Number of points per wavelength in the background medium with which to discretize the surface monitors for the projection. If None, fields will will not resampled, but will still be colocated.

  • origin (Optional[tuple[float, float, float]] = None) – [units = um]. Local origin used for defining observation points. If None, uses the average of the centers of all surface monitors.

Notes

See also

FieldProjectionAngleMonitor

Monitor that samples electromagnetic near fields in the frequency domain and projects them at given observation angles.

Notebooks:

Attributes

currents

Sets the surface currents.

effective_simulation_size

Simulation-size tuple used by 2D-specific projection logic.

frequencies

Return the list of frequencies associated with the field monitors.

is_2d_simulation

medium

Medium into which fields are to be projected.

sim_data

surfaces

pts_per_wavelength

origin

Methods

apply_window_to_currents(proj_monitor, currents)

Apply windowing function to the surface currents.

compute_surface_currents(sim_data, surface, ...)

Returns resampled surface current densities associated with the surface monitor.

from_near_field_data(near_field_data, name, ...)

Construct a local projector and Cartesian projection monitor from raw near-field data.

from_near_field_monitors(sim_data, ...[, ...])

Constructs FieldProjection from a list of surface monitors and their directions.

project_fields(proj_monitor[, verbose, ...])

Compute projected fields.

trapezoid(ary, pts[, axes])

Trapezoidal integration in n dimensions.

sim_data#
surfaces#
pts_per_wavelength#
origin#
property is_2d_simulation#
property effective_simulation_size#

Simulation-size tuple used by 2D-specific projection logic.

property medium#

Medium into which fields are to be projected.

property frequencies#

Return the list of frequencies associated with the field monitors.

classmethod from_near_field_monitors(sim_data, near_monitors, normal_dirs, pts_per_wavelength=10, origin=None)[source]#

Constructs FieldProjection from a list of surface monitors and their directions.

Parameters:
  • sim_data (SimulationData) – Container for simulation data containing the near field monitors.

  • near_monitors (list[FieldMonitor]) – tuple of FieldMonitor objects on which near fields will be sampled.

  • normal_dirs (list[Literal['+', '-']]) – tuple containing the Literal['+', '-'] of the normal to each surface monitor w.r.t. to the positive x, y or z unit vectors. Must have the same length as monitors.

  • pts_per_wavelength (int = 10) – Number of points per wavelength with which to discretize the surface monitors for the projection. If None, fields will not be resampled.

  • origin (tuple[float, float, float]) – Local origin used for defining observation points. If None, uses the average of the centers of all surface monitors.

classmethod from_near_field_data(near_field_data, name, x, y, proj_axis, proj_distance, normal_dir, medium, dimensionality='auto', pts_per_wavelength=10, origin=None, far_field_approx=True)[source]#

Construct a local projector and Cartesian projection monitor from raw near-field data.

Parameters:
  • near_field_data (FieldData) – Near-field data object to use as the projection source.

  • name (str) – Name of the returned Cartesian projection monitor.

  • x (list[float]) – Local x observation coordinates of the returned Cartesian projection monitor.

  • y (list[float]) – Local y observation coordinates of the returned Cartesian projection monitor.

  • proj_axis (int) – Axis normal to the Cartesian observation plane.

  • proj_distance (float) – Signed distance of the Cartesian observation plane along proj_axis.

  • normal_dir (Literal['+', '-']) – Direction of the source surface normal relative to the positive global axis.

  • medium (MediumType) – Homogeneous medium through which the source fields are projected.

  • dimensionality (Literal["auto", "2D", "3D"] = "auto") – Whether to interpret the raw source as line-like 2D data or surface-like 3D data. "auto" infers this from the tangential coordinate support of near_field_data.

  • pts_per_wavelength (int = 10) – Number of points per wavelength with which to discretize the surface monitors for the projection. If None, fields will not be resampled.

  • origin (tuple[float, float, float]) – Local origin used for defining observation points. If None, uses the near-field monitor center.

  • far_field_approx (bool = True) – Whether the returned Cartesian projection monitor uses the far-field approximation.

property currents#

Sets the surface currents.

static compute_surface_currents(sim_data, surface, medium, pts_per_wavelength=10)[source]#

Returns resampled surface current densities associated with the surface monitor.

Parameters:
  • sim_data (SimulationData or FieldData) – Simulation-backed monitor data source or raw field data associated with the given near-field surface.

  • surface (FieldProjectionSurface) – FieldProjectionSurface to use as source of near field.

  • medium (MediumType) – Background medium through which to project fields.

  • pts_per_wavelength (int = 10) – Number of points per wavelength with which to discretize the surface monitors for the projection. If None, fields will not be resampled, but will still be colocated.

Returns:

Colocated surface current densities for the given surface.

Return type:

xarray.Dataset

static trapezoid(ary, pts, axes=0)[source]#

Trapezoidal integration in n dimensions.

Parameters:
  • ary (np.ndarray) – Array to integrate.

  • pts (Iterable[np.ndarray]) – Iterable of points for each dimension.

  • axes (Iterable[int] | int) – Iterable of axes along which to integrate. If not an iterable, assume 1D integration.

Returns:

Integrated array.

Return type:

np.ndarray

static apply_window_to_currents(proj_monitor, currents)[source]#

Apply windowing function to the surface currents.

project_fields(proj_monitor, verbose=True, freq_chunk_size=8)[source]#

Compute projected fields.

Parameters:
  • proj_monitor (AbstractFieldProjectionMonitor) – Instance of AbstractFieldProjectionMonitor defining the projection observation grid.

  • verbose (bool = True) – Whether to display local progress bars while computing the projection.

  • freq_chunk_size (int | None = 8) – Number of frequencies to prepare at once for chunked projection paths. If None, all frequencies are prepared together. Used for exact projection and approximate Cartesian and k-space projection. Ignored for approximate angular projection.

Returns:

Data structure with Er, Etheta, Ephi, Hr, Htheta, Hphi.

Return type:

AbstractFieldProjectionData