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, - attrsare mutable. For example, the following is allowed for setting an- attr- obj.attrs['foo'] = bar. Also note that Tidy3D` will raise a- TypeErrorif- attrscontain objects that can not be serialized. One can check if- attrsare 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.