compute#
- DEpsCalculator.compute(params: ndarray, dp: ndarray | float | None = None, polygon_name: str | None = None) tuple[dict[str, ndarray], ndarray, ndarray]#
Compute the sparse Jacobian dEps/dP using central differences.
This is the main entry point. It switches to layout mode, resets monitors, perturbs each geometric parameter via central differences, and returns the sparse dEps/dP data together with the global index monitor shape.
- Parameters:
- params
np.ndarray The optimization parameters at which to evaluate dEps/dP.
- dp
np.ndarray|float,optional The perturbation size for each parameter. If None, it will be automatically computed based on machine epsilon and parameter bounds.
- polygon_name
str,optional Override for the FDTD CAD polygon name used when grabbing the bounding box for
ClosedCurveperturbations. WhenNone(default), falls back to the polygon name inself.parametrization.structure. Used byCombinedParametrizationto disambiguate per-child polygons.
- params
- Returns:
- d_eps_dP_dict
dict[str,dict[str,dict[str,np.ndarray]]] Nested dictionary. Top-level keys are
'object_name::property_name'strings. Each value is a dict with keys'eps_x','eps_y','eps_z', where each entry is a dict with'data','indices', and'indptr'arrays representing the sparse dEps/dP.- global_shape
np.ndarray Shape
(4,)array[Nx, Ny, Nz, Nlambda]of the full (un-cropped) index monitor.- wl_metres
np.ndarray 1D array of size (1,) containing the wavelength in metres corresponding to the index monitor data.
- d_eps_dP_dict