tidy3d.components.time.AbstractTimeDependence#

class AbstractTimeDependence[source]#

Bases: ABC, Tidy3dBaseModel

Base class describing time dependence.

Parameters:
  • attrs (dict = {}) – Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields, attrs are mutable. For example, the following is allowed for setting an attr obj.attrs['foo'] = bar. Also note that Tidy3D` will raise a TypeError if attrs contain objects that can not be serialized. One can check if attrs are serializable by calling obj.json().

  • amplitude (NonNegativeFloat = 1.0) – Real-valued maximum amplitude of the time dependence.

  • phase (float = 0.0) – [units = rad]. Phase shift of the time dependence.

Attributes

Methods

amp_time(time)

Complex-valued amplitude as a function of time.

plot(times[,Β val,Β ax])

Plot the complex-valued amplitude of the time-dependence.

plot_spectrum_in_frequency_range(times,Β ...)

Plot the complex-valued amplitude of the time-dependence.

spectrum(times,Β freqs,Β dt)

Complex-valued spectrum as a function of frequency.

Inherited Common Usage

amplitude#
phase#
abstract amp_time(time)[source]#

Complex-valued amplitude as a function of time.

Parameters:

time (float) – Time in seconds.

Returns:

Complex-valued amplitude at that time.

Return type:

complex

spectrum(times, freqs, dt)[source]#

Complex-valued spectrum as a function of frequency. Note: Only the real part of the time signal is used.

Parameters:
  • times (np.ndarray) – Times to use to evaluate spectrum Fourier transform. (Typically the simulation time mesh).

  • freqs (np.ndarray) – Frequencies in Hz to evaluate spectrum at.

  • dt (float or np.ndarray) – Time step to weight FT integral with. If array, use to weigh each of the time intervals in times.

Returns:

Complex-valued array (of len(freqs)) containing spectrum at those frequencies.

Return type:

np.ndarray

plot_spectrum_in_frequency_range(times, fmin, fmax, num_freqs=101, val='real', ax=None)[source]#

Plot the complex-valued amplitude of the time-dependence. Note: Only the real part of the time signal is used.

Parameters:
  • times (np.ndarray) – Array of evenly-spaced times (seconds) to evaluate time-dependence at. The spectrum is computed from this value and the time frequency content. To see spectrum for a specific Simulation, pass simulation.tmesh.

  • fmin (float) – Lower bound of frequency for the spectrum plot.

  • fmax (float) – Upper bound of frequency for the spectrum plot.

  • num_freqs (int = 101) – Number of frequencies to plot within the [fmin, fmax].

  • ax (matplotlib.axes._subplots.Axes = None) – Matplotlib axes to plot on, if not specified, one is created.

Returns:

The supplied or created matplotlib axes.

Return type:

matplotlib.axes._subplots.Axes

plot(times, val='real', ax=None)[source]#

Plot the complex-valued amplitude of the time-dependence.

Parameters:
  • times (np.ndarray) – Array of times (seconds) to plot source at. To see source time amplitude for a specific Simulation, pass simulation.tmesh.

  • val (Literal['real', 'imag', 'abs'] = 'real') – Which part of the spectrum to plot.

  • ax (matplotlib.axes._subplots.Axes = None) – Matplotlib axes to plot on, if not specified, one is created.

Returns:

The supplied or created matplotlib axes.

Return type:

matplotlib.axes._subplots.Axes

__hash__()#

Hash method.