tidy3d.plugins.adjoint.utils.filter.BinaryProjector#

class BinaryProjector[source]#

Bases: Filter

Projects a grayscale image towards min and max values using a smooth tanh function.

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().

  • 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. If True, 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#
evaluate(spatial_data)[source]#

Process on supplied spatial data.

__hash__()#

Hash method.