tidy3d.components.source.SourceTime#

class SourceTime[source]#

Bases: AbstractTimeDependence

Base class describing the time dependence of a source.

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

attrs

Methods

end_time()

Time after which the source is effectively turned off / close to zero amplitude.

frequency_range([num_fwidth])

Frequency range within plus/minus num_fwidth * fwidth of the central frequency.

plot_spectrum(times[, num_freqs, val, ax])

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

Inherited Common Usage

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

Plot the complex-valued amplitude of the source 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 source time-dependence at. The spectrum is computed from this value and the source time frequency content. To see source spectrum for a specific Simulation, pass simulation.tmesh.

  • num_freqs (int = 101) – Number of frequencies to plot within the SourceTime.frequency_range.

  • 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

abstract frequency_range(num_fwidth=4.0)[source]#

Frequency range within plus/minus num_fwidth * fwidth of the central frequency.

abstract end_time()[source]#

Time after which the source is effectively turned off / close to zero amplitude.

__hash__()#

Hash method.