vector.compute_tangent_field
vector.compute_tangent_field
Compute the tangent vector field for arr
.
The calculation finds the minimum of a quadratic loss function using a single Newton iteration. Rather than optimizing the real-space tangent field, the Fourier coefficients are directly optimized.
The tangent field has several properties or invariances:
- The tangent field is independent of the scale of the unit cell; if the unit cell is uniformly scaled (e.g. by changing units from nm to microns), the vector field is unchanged.
- The tangent field for a supercell (containing e.g. 2x2 unit cells) is identical to that of a single unit cell, so long as the number of terms in the Fourier expansion is increased correspondingly. Note that this means that the tangent field depends upon the number of terms in the Fourier expansion.
- The tangent field is independent of the resolution of the discretized unit
cell. That is, whether the permittivity distribution is specified with a
(100, 100)
or(200, 200)
shaped array has no impact on the resulting field. - The tangent field is independent of the amplitude of the array from which it is obtained, e.g. the permittivity contrast.
Args:
- arr: The array for which the normal vector field is sought.
- expansion: The Fourier expansion for which the field is to be optimized.
- primitive_lattice_vectors: Define the unit cell coordinates.
- use_jones_direct: Specifies whether the complex Jones field is to be sought.
- fourier_loss_weight: Determines the weight of the loss term penalizing Fourier terms corresponding to high frequencies. Should be positive.
- smoothness_loss_weight: Determines the weight of the loss term rewarding smoothness of the tangent field in real space. Should be positive.
- steps: The number of Newton iterations to carry out. Generally, the default single iteration is sufficient to obtain converged fields.
Returns:
- None: The normal field,
(tx, ty)
.