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:
paramsnp.ndarray

The optimization parameters at which to evaluate dEps/dP.

dpnp.ndarray | float, optional

The perturbation size for each parameter. If None, it will be automatically computed based on machine epsilon and parameter bounds.

polygon_namestr, optional

Override for the FDTD CAD polygon name used when grabbing the bounding box for ClosedCurve perturbations. When None (default), falls back to the polygon name in self.parametrization.structure. Used by CombinedParametrization to disambiguate per-child polygons.

Returns:
d_eps_dP_dictdict[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_shapenp.ndarray

Shape (4,) array [Nx, Ny, Nz, Nlambda] of the full (un-cropped) index monitor.

wl_metresnp.ndarray

1D array of size (1,) containing the wavelength in metres corresponding to the index monitor data.