fdtdx.WaveCharacter#

class fdtdx.WaveCharacter(*, phase_shift=0.0, period=None, wavelength=None, frequency=None)[source]#

Bases: TreeClass

Class describing a wavelength/period/frequency in free space. Importantly, the wave characteristic conversion is based on a free space wave when using the wavelength (For conversion, a refractive index of 1 is used).

Quick Reference#

Attributes

Methods

Attributes#

WaveCharacter.frequency: float | None#

Optional frequency in Hz. Mutually exclusive with period and wavelength.

WaveCharacter.period: float | None#

Optional period in seconds. Mutually exclusive with wavelength and frequency. Defaults to None.

WaveCharacter.phase_shift: float#

Phase shift in radians. Defaults to 0.

WaveCharacter.wavelength: float | None#

Optional wavelength in meters for free space propagation. Mutually exclusive with period and frequency. Defaults to None.

Methods#

WaveCharacter.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

WaveCharacter.get_class_fields()#
Return type:

list[TreeClassField]

WaveCharacter.get_frequency()[source]#
Return type:

float

WaveCharacter.get_period()[source]#
Return type:

float

WaveCharacter.get_public_fields()#
Return type:

list[TreeClassField]

WaveCharacter.get_wavelength()[source]#
Return type:

float

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