CombinedParametrization#

class lumopt2.parametrization.combined_parametrization.CombinedParametrization(parametrizations: List[BaseParametrization])#

Combine multiple parametrizations into a single parametrization.

The optimization parameter vector is the concatenation of each child’s parameters. Bounds, initial values, structure updates, and gradient computations are automatically split and delegated to the corresponding child.

All children must share the exact same optimization region. A ValueError is raised at construction time if any child’s region differs from the first child’s region.

Nesting is not supported: any element of parametrizations that is itself a CombinedParametrization raises TypeError at construction time. Pass all parametrizations as a single flat list instead.

Parameters:
parametrizationsList[BaseParametrization]

Flat list of parametrization instances to combine. Accepted concrete types are ClosedCurve and Parametrization.

Attributes:
parametrizationsList[BaseParametrization]

The child parametrization instances.

n_paramsint

Total number of optimization parameters across all children.

Raises:
TypeError

If any element of parametrizations is not an accepted type, or if any element is itself a CombinedParametrization (nesting is not supported).

ValueError

If parametrizations is empty, not a list, or the children have different optimization regions.

Examples

>>> import lumopt2 as lmpt
>>> from lumopt2.parametrization import (
...     CombinedParametrization, Parametrization, ClosedCurve)
>>> combined = CombinedParametrization([param_a, closed_curve_b])
>>> combined.n_params
10

Methods

CombinedParametrization.compute_gradient_from_fields(...)

Compute the gradient by delegating to each child parametrization.

CombinedParametrization.compute_opt_params_direct_to_permittivity_jacobian(...)

Compute d_eps/dp, the (sparse) Jacobian of the permittivity wrt optimization parameters ('p').

CombinedParametrization.create_optimization_structures(...)

Add optimization structure to FDTD simulation.

CombinedParametrization.get_bounds()

Get concatenated parameter bounds from all children.

CombinedParametrization.get_initial_params()

Concatenated initial parameters from all children.

CombinedParametrization.store_mesh_info(...)

Read the locked grid and store mesh info in structure.

CombinedParametrization.update_structure(...)

Update all children's geometries in the FDTD simulation.

Attributes

CombinedParametrization.bounds

Concatenated parameter bounds from all children.