fdtdx.GaussianPulseProfile#

class fdtdx.GaussianPulseProfile(*, spectral_width=null, center_wave=null)[source]#

Bases: TemporalProfile

Gaussian pulse temporal profile with carrier wave.

The pulse envelope is characterized by its spectral width, which determines the temporal width of the pulse. The carrier wave can be specified using any of the WaveCharacter parameters (wavelength, frequency, or period).

Quick Reference#

Attributes

Methods

Attributes#

GaussianPulseProfile.center_wave: WaveCharacter#

Center frequency/wavelength of the carrier wave

GaussianPulseProfile.spectral_width: WaveCharacter#

Spectral width of the Gaussian envelope (can specify via wavelength, frequency, or period)

Methods#

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

GaussianPulseProfile.frequency_spectrum(period, time_step_duration, num_time_steps, phase_shift=0.0, normalize=True)#

Return the one-sided FFT magnitude of the sampled source signal.

Return type:

tuple[ndarray, ndarray]

GaussianPulseProfile.get_amplitude(time, period, phase_shift=0.0)[source]#

Calculate the temporal amplitude at given time points.

Parameters:
  • time (jax.Array) – Time points to evaluate amplitude at

  • period (float) – Period of the carrier wave (1/frequency)

  • phase_shift (float) – Phase shift of the carrier wave

Returns:

Amplitude values at the given time points

Return type:

jax.Array

GaussianPulseProfile.get_class_fields()#
Return type:

list[TreeClassField]

GaussianPulseProfile.get_frequency_plot_range(period, frequencies, spectrum)[source]#

Return a profile-specific frequency plot range, or None to use automatic range detection.

Subclasses may override this hook when the profile has known physical frequency properties (e.g. a Gaussian pulse).

Return type:

tuple[float, float] | None

GaussianPulseProfile.get_public_fields()#
Return type:

list[TreeClassField]

GaussianPulseProfile.get_reference_frequency(period)[source]#

Return the frequency expected to dominate the plotted spectrum.

Return type:

float

GaussianPulseProfile.get_time_plot_range(period, total_time)[source]#

Return a profile-specific time plot range, or None to use automatic range detection.

Subclasses may override this hook when the profile has known physical time properties (e.g. a Gaussian pulse).

Return type:

tuple[float, float] | None

GaussianPulseProfile.plot_time_signal_and_spectrum(period, time_step_duration, num_time_steps, phase_shift=0.0, axs=None, filename=None, time_range='auto', frequency_range='auto', relative_threshold=0.01, normalize_spectrum=True)#

Plot the sampled source time signal and its one-sided frequency spectrum.

GaussianPulseProfile.sample_time_signal(period, time_step_duration, num_time_steps, phase_shift=0.0)#

Sample this temporal profile at the same cadence as an FDTD simulation.

Return type:

tuple[ndarray, ndarray]

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