PNorm#

lumopt2.utils.common.PNorm(target: float | int | ~numpy.ndarray = 1.0, p: int | float | ~autograd.numpy.numpy_wrapper.wrap_intdtype.<locals>.IntdtypeSubclass | ~numpy.floating = 1.0, weights: float | int | ~numpy.ndarray = 1.0) callable#

Create a p-norm based figure of merit function.

Parameters:
targetfloat or array_like, optional

Target transmission (scalar or array of same size as wavelengths, default: 1).

pfloat, optional

P-norm to use (default: 1).

weightsfloat or array_like, optional

Wavelength-dependent weights (scalar or array of same size as wavelengths, default: 1).

Returns:
Callable

Function that computes the p-norm FOM for a given port.

Raises:
TypeError

If target, p, or weights are not numeric types.

ValueError

If p is not positive, or if weights contains negative values.