tidy3d.plugins.adjoint.utils.filter.BinaryProjector#
- class BinaryProjector[source]#
Bases:
FilterProjects a grayscale image towards min and max values using a smooth
tanhfunction.- 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 anattrobj.attrs['foo'] = bar. Also note that Tidy3D` will raise aTypeErrorifattrscontain objects that can not be serialized. One can check ifattrsare serializable by callingobj.json().vmin (float) β Minimum value to project to.
vmax (float) β Maximum value to project to.
beta (float = 1.0) β Steepness of the binarization, higher means more sharp transition at the expense of gradient accuracy and ease of optimization. Can be useful to ramp up in a scheduled way during optimization.
eta (float = 0.5) β Halfway point in projection function.
strict_binarize (bool = False) β If
False, the binarization is still continuous between min and max. IfTrue, the values are snapped to the min and max values after projection.
Note
\[v(x) = v_{min} + (v_{max} - v_{min}) \frac{\mathrm{tanh}(\beta \eta) + \mathrm{tanh}(\beta (x - \eta))} {\mathrm{tanh}(\beta \eta) + \mathrm{tanh}(\beta (1 - \eta))}\]Attributes
Methods
evaluate(spatial_data)Process on supplied spatial data.
Inherited Common Usage
- vmin#
- vmax#
- beta#
- eta#
- strict_binarize#
- __hash__()#
Hash method.