tidy3d.plugins.autograd.invdes.symmetrize_rotation

tidy3d.plugins.autograd.invdes.symmetrize_rotation#

class symmetrize_rotation[source]#

Bases:

Symmetrizes the parameter array by averaging over all four 90-degree rotations. The input array must be square.

Parameters:

array (NDArray) – The input array to be symmetrized.

Returns:

The array after applying rotational symmetrization.

Return type:

NDArray

Example

>>> import autograd.numpy as np
>>> from tidy3d.plugins.autograd.invdes.symmetries import symmetrize_rotation
>>> arr = np.asarray([
...     [0, 0, 0],
...     [1, 5, 2],
...     [8, 1, 8]
... ])
>>> res = symmetrize_rotation(arr)
>>> assert np.all(np.isclose(res, np.asarray([
...     [4, 1, 4],
...     [1, 5, 1],
...     [4, 1, 4]
... ])))

Inherited Common Usage