tidy3d.FieldProjector#
- class FieldProjector[source]#
Bases:
Tidy3dBaseModel
Projection of near fields to points on a given observation grid.
- Parameters:
attrs (dict = {}) – Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields,
attrs
are mutable. For example, the following is allowed for setting anattr
obj.attrs['foo'] = bar
. Also note that Tidy3D` will raise aTypeError
ifattrs
contain objects that can not be serialized. One can check ifattrs
are serializable by callingobj.json()
.sim_data (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.this (.. TODO make images to illustrate)
See also
- :class:`FieldProjectionAngleMonitor
Monitor
that samples electromagnetic near fields in the frequency domain and projects them at given observation angles.`- Notebooks:
Attributes
Sets the surface currents.
Return the list of frequencies associated with the field monitors.
Medium into which fields are to be projected.
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_monitors
(sim_data, ...[, ...])Constructs
FieldProjection
from a list of surface monitors and their directions.project_fields
(proj_monitor)Compute projected fields.
set_origin
(val, values)Sets .origin as the average of centers of all surface monitors if not provided.
trapezoid
(ary, pts[, axes])Trapezoidal integration in n dimensions.
Inherited Common Usage
- sim_data#
- surfaces#
- pts_per_wavelength#
- origin#
- property is_2d_simulation#
- classmethod set_origin(val, values)[source]#
Sets .origin as the average of centers of all surface monitors if not provided.
- 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 ofFieldMonitor
objects on which near fields will be sampled.normal_dirs (List[
Direction
]) – Tuple containing theDirection
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 (
Coordinate
) – Local origin used for defining observation points. IfNone
, uses the average of the centers of all surface monitors.
- 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
) – Container for simulation data containing the near field monitors.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 (Union[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)[source]#
Compute projected fields.
- Parameters:
proj_monitor (
AbstractFieldProjectionMonitor
) – Instance ofAbstractFieldProjectionMonitor
defining the projection observation grid.- Returns:
Data structure with
Er
,Etheta
,Ephi
,Hr
,Htheta
,Hphi
.- Return type:
- __hash__()#
Hash method.