¶
Detectors¶
In FDTDX, detectors can be used to perform measurements within a simulation. In conjunction with the Logger, these detectors can also automatically produce plots or even videos.
fdtdx.objects.detectors.EnergyDetector
¶
Bases: Detector
Detector for measuring electromagnetic energy distribution.
This detector computes and records the electromagnetic energy density at specified points in the simulation volume. It can operate in different modes to either record full 3D data, 2D slices, or reduced volume measurements.
Attributes:
Name | Type | Description |
---|---|---|
as_slices |
bool
|
If True, returns energy measurements as 2D slices through the volume center. If False, returns full 3D volume or reduced measurements. |
reduce_volume |
bool
|
If True, reduces the volume data to a single energy value by summing. If False, maintains spatial distribution of energy. |
Source code in src/fdtdx/objects/detectors/energy.py
fdtdx.objects.detectors.PoyntingFluxDetector
¶
Bases: Detector
Detector for measuring Poynting flux in electromagnetic simulations.
This detector computes the Poynting flux (power flow) through a specified surface in the simulation volume. It can measure flux in either positive or negative direction along the propagation axis, and optionally reduce measurements to a single value by summing over the detection surface.
Attributes:
Name | Type | Description |
---|---|---|
direction |
Literal['+', '-']
|
Direction of flux measurement, either "+" for positive or "-" for negative along the propagation axis. |
reduce_volume |
bool
|
If True, reduces measurements to a single value by summing over the detection surface. If False, maintains spatial distribution. |
Source code in src/fdtdx/objects/detectors/poynting_flux.py
propagation_axis: int
property
¶
Determines the axis along which Poynting flux is measured.
The propagation axis is identified as the dimension with size 1 in the detector's grid shape, representing a plane perpendicular to the flux measurement direction.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Index of the propagation axis (0 for x, 1 for y, 2 for z) |
Raises:
Type | Description |
---|---|
Exception
|
If detector shape does not have exactly one dimension of size 1 |
fdtdx.objects.detectors.PhasorDetector
¶
Bases: Detector
Detector for measuring phasor components of electromagnetic fields.
This detector computes complex phasor representations of the field components at specified frequencies, enabling frequency-domain analysis of the electromagnetic fields.
Attributes:
Name | Type | Description |
---|---|---|
frequencies |
Sequence[float]
|
Sequence of frequencies to analyze (in Hz) |
as_slices |
bool
|
If True, returns results as slices rather than full volume. |
reduce_volume |
bool
|
If True, reduces the volume of recorded data. |
components |
Sequence[Literal['Ex', 'Ey', 'Ez', 'Hx', 'Hy', 'Hz']]
|
Sequence of field components to measure. Can include any of: "Ex", "Ey", "Ez", "Hx", "Hy", "Hz". |
Source code in src/fdtdx/objects/detectors/phasor.py
fdtdx.objects.detectors.DiffractiveDetector
¶
Bases: Detector
Detector for computing Fourier transforms of fields at specific frequencies and diffraction orders.
This detector computes field amplitudes for specific diffraction orders and frequencies through a specified plane in the simulation volume. It can measure diffraction in either positive or negative direction along the propagation axis.
Attributes:
Name | Type | Description |
---|---|---|
frequencies |
Sequence[float]
|
List of frequencies to analyze (in Hz) |
orders |
Sequence[Tuple[int, int]]
|
Tuple of (nx, ny) pairs specifying diffraction orders to compute |
direction |
Literal['+', '-']
|
Direction of diffraction analysis ("+" or "-") along propagation axis |
Source code in src/fdtdx/objects/detectors/diffractive.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
propagation_axis: int
property
¶
Determines the axis along which diffraction is measured.
The propagation axis is identified as the dimension with size 1 in the detector's grid shape, representing a plane perpendicular to the diffraction measurement direction.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Index of the propagation axis (0 for x, 1 for y, 2 for z) |
Raises:
Type | Description |
---|---|
Exception
|
If detector shape does not have exactly one dimension of size 1 |