fdtdx.DiagonalSymmetry3D#

class fdtdx.DiagonalSymmetry3D(*, diagonal_plane='xy', min_min_to_max_max=True)[source]#

Bases: SameShapeTypeParameterTransform

Enforce diagonal symmetry in 3D across one of six possible diagonal planes.

The diagonal planes are defined by which two axes are swapped (transposed): - ‘xy’: Diagonal in the xy-plane (swaps x and y, z unchanged) - ‘xz’: Diagonal in the xz-plane (swaps x and z, y unchanged) - ‘yz’: Diagonal in the yz-plane (swaps y and z, x unchanged)

For each plane, there are two diagonals controlled by min_min_to_max_max: - True: The diagonal from (min, min) to (max, max) in that plane - False: The anti-diagonal from (min, max) to (max, min) in that plane

Note: The two dimensions being swapped must be equal in size.

Quick Reference#

Attributes

Methods

Attributes#

DiagonalSymmetry3D.diagonal_plane: str#

The plane in which the diagonal lies. One of ‘xy’, ‘xz’, or ‘yz’. Defaults to ‘xy’ for backwards compatibility.

DiagonalSymmetry3D.min_min_to_max_max: bool#

If true, the symmetry is across the main diagonal (min,min → max,max). If false, the anti-diagonal (min,max → max,min) is used.

Methods#

DiagonalSymmetry3D.aset(attr_name, val, create_new_ok=False)#

Sets an attribute of this class. In contrast to the classical .at[].set(), this method updates the class attribute directly and does not only operate on jax pytree leaf nodes. Instead, replaces the full attribute with the new value.

The attribute can either be the attribute name of this class, or for nested classes it can also be the attribute name of a class, which itself is an attribute of this class. The syntax for this operation could look like this: “a->b->[0]->[‘name’]”. Here, the current class has an attribute a, which has an attribute b, which is a list, which we index at index 0, which is an element of type dictionary, which we index using the dictionary key ‘name’.

Note that dictionary keys cannot contain square brackets or single quotes (even if they are escaped).

Parameters:
  • attr_name (str) – Name of attribute to set

  • val (Any) – Value to set the attribute to

  • create_new_ok (bool, optional) – If false (default), throw an error if the attribute does not exist. If true, creates a new attribute if the attribute name does not exist yet.

Returns:

Updated instance with new attribute value

Return type:

Self

DiagonalSymmetry3D.get_class_fields()#
Return type:

list[TreeClassField]

DiagonalSymmetry3D.get_input_shape(output_shape)#
Return type:

dict[str, tuple[int, ...]]

DiagonalSymmetry3D.get_output_type(input_type)#
Return type:

dict[str, ParameterType]

DiagonalSymmetry3D.get_public_fields()#
Return type:

list[TreeClassField]

DiagonalSymmetry3D.init_module(config, materials, matrix_voxel_grid_shape, single_voxel_size, output_shape)#
Return type:

Self

DiagonalSymmetry3D.init_type(input_type)#
Return type:

Self

If you find any errors in the documentation, please report them in the Github Issues!