tidy3d.plugins.autograd.invdes.ErosionDilationPenalty#

class ErosionDilationPenalty[source]#

Bases: Tidy3dBaseModel

A class that computes a penalty for erosion/dilation of a parameter map not being unity.

Parameters:
  • attrs (dict = {}) – Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields, attrs are mutable. For example, the following is allowed for setting an attr obj.attrs['foo'] = bar. Also note that Tidy3D` will raise a TypeError if attrs contain objects that can not be serialized. One can check if attrs are serializable by calling obj.json().

  • radius (Union[float, tuple[float, ...]]) – The radius of the kernel.

  • dl (Union[float, tuple[float, ...]]) – The grid spacing.

  • size_px (Union[int, tuple[int, ...]] = None) – The size of the kernel in pixels.

  • beta (NonNegativeFloat = 20.0) – The beta parameter for the tanh projection.

  • eta (NonNegativeFloat = 0.5) – The eta parameter for the tanh projection.

  • filter_type (str = conic) – The type of filter to create.

  • padding (Literal['constant', 'edge', 'reflect', 'symmetric', 'wrap'] = reflect) – The padding mode to use.

  • delta_eta (float = 0.01) – The binarization threshold for erosion and dilation operations.

Attributes

Methods

Inherited Common Usage

radius#
dl#
size_px#
beta#
eta#
filter_type#
padding#
delta_eta#
__call__(array)[source]#

Compute the erosion/dilation penalty for a given array.

Parameters:

array (np.ndarray) – The input array to compute the penalty for.

Returns:

The computed erosion/dilation penalty.

Return type:

float

__hash__()#

Hash method.