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 anattr
obj.attrs['foo'] = bar
. Also note that Tidy3D` will raise aTypeError
ifattrs
contain objects that can not be serialized. One can check ifattrs
are serializable by callingobj.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
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
, passsimulation.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.