Objective function for the optimization. Args: dft_ex: the discrete Fourier-transformed Ex fields as a 2D array of dimension (num_wavelengths, NX_DESIGN_GRID * NY_DESIGN_GRID). Returns: A tuple of the log of the integrals of Ex in the stack for each
(dft_ex: np.ndarray)
| 207 | ] |
| 208 | |
| 209 | def obj_func(dft_ex: np.ndarray) -> Tuple[float]: |
| 210 | """Objective function for the optimization. |
| 211 | |
| 212 | Args: |
| 213 | dft_ex: the discrete Fourier-transformed Ex fields as a 2D array of |
| 214 | dimension (num_wavelengths, NX_DESIGN_GRID * NY_DESIGN_GRID). |
| 215 | |
| 216 | Returns: |
| 217 | A tuple of the log of the integrals of Ex in the stack for each |
| 218 | wavelength. |
| 219 | """ |
| 220 | return npa.log(npa.sum(npa.absolute(dft_ex) ** 2, axis=1)) |
| 221 | |
| 222 | opt = mpa.OptimizationProblem( |
| 223 | simulation=sim, |