MCPcopy Create free account
hub / github.com/NanoComp/meep / obj_func

Function obj_func

python/examples/adjoint_optimization/multilayer_opt.py:209–220  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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,

Callers

nothing calls this directly

Calls 1

logMethod · 0.80

Tested by

no test coverage detected