tidy3d.plugins.adjoint.utils.penalty.RadiusPenalty#
- class RadiusPenalty[source]#
- Bases: - Penalty- Computes a penalty for small radius of curvature determined by a fit of points in a 2D plane. - 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().
- min_radius (float = 0.15) – [units = um]. Radius of curvature value below which the penalty ramps to its maximum value. 
- alpha (float = 1.0) – Parameter controlling the strength of the penalty. 
- kappa (float = 10.0) – [units = 1/um]. Parameter controlling the steepness of the penalty evaluation. 
- wrap (bool = False) – Whether to consider the first set of points as connected to the last. 
 
 - Note \[p(r) = \frac{\mathrm{exp}(-\kappa(r - r_{min}))}{1 + \mathrm{exp}(-\kappa(r - r_{min}))}\]- Note - This formula was described by A. Micheals et al. “Leveraging continuous material averaging for inverse electromagnetic design”, Optics Express (2018). - Attributes - Methods - evaluate(points)- Get the average penalty as a function of supplied (x, y) points by fitting a spline to the curve and evaluating local radius of curvature compared to a desired minimum value. - Inherited Common Usage - min_radius#
 - alpha#
 - kappa#
 - wrap#
 - evaluate(points)[source]#
- Get the average penalty as a function of supplied (x, y) points by fitting a spline to the curve and evaluating local radius of curvature compared to a desired minimum value. If - wrap, it is assumed that the points wrap around to form a closed geometry instead of an isolated line segment.
 - __hash__()#
- Hash method.