Computes the radiation pattern from the far fields. Args: sim: a `Simulation` object. n2f_mon: a `DftNear2Far` object returned by `Simulation.add_near2far`. Returns: Array of radial Poynting flux, one for each point on the circumference of a quarter circle w
(sim: mp.Simulation, n2f_mon: mp.DftNear2Far)
| 97 | |
| 98 | |
| 99 | def radiation_pattern(sim: mp.Simulation, n2f_mon: mp.DftNear2Far) -> np.ndarray: |
| 100 | """Computes the radiation pattern from the far fields. |
| 101 | |
| 102 | Args: |
| 103 | sim: a `Simulation` object. |
| 104 | n2f_mon: a `DftNear2Far` object returned by `Simulation.add_near2far`. |
| 105 | |
| 106 | Returns: |
| 107 | Array of radial Poynting flux, one for each point on the circumference of |
| 108 | a quarter circle with angular range of [0, π/2] rad. 0 rad is the +z |
| 109 | direction and π/2 is +r. |
| 110 | """ |
| 111 | e_field = np.zeros((NUM_POLAR, 3), dtype=np.complex128) |
| 112 | h_field = np.zeros((NUM_POLAR, 3), dtype=np.complex128) |
| 113 | for i in range(NUM_POLAR): |
| 114 | far_field = sim.get_farfield( |
| 115 | n2f_mon, |
| 116 | mp.Vector3( |
| 117 | FARFIELD_RADIUS_UM * math.sin(polar_rad[i]), |
| 118 | 0, |
| 119 | FARFIELD_RADIUS_UM * math.cos(polar_rad[i]), |
| 120 | ), |
| 121 | GREENCYL_TOL, |
| 122 | ) |
| 123 | e_field[i, :] = [far_field[j] for j in range(3)] |
| 124 | h_field[i, :] = [far_field[j + 3] for j in range(3)] |
| 125 | |
| 126 | flux_x = np.real( |
| 127 | np.conj(e_field[:, 1]) * h_field[:, 2] - np.conj(e_field[:, 2]) * h_field[:, 1] |
| 128 | ) |
| 129 | flux_z = np.real( |
| 130 | np.conj(e_field[:, 0]) * h_field[:, 1] - np.conj(e_field[:, 1]) * h_field[:, 0] |
| 131 | ) |
| 132 | flux_r = np.sqrt(np.square(flux_x) + np.square(flux_z)) |
| 133 | |
| 134 | return flux_r |
| 135 | |
| 136 | |
| 137 | def disc_radiated_flux(disc_um: float, source_zpos: float) -> Tuple[float, float]: |
no test coverage detected