tidy3d.components.time.AbstractTimeDependence#
- class AbstractTimeDependence[source]#
Bases:
ABC,Tidy3dBaseModelBase class describing time dependence.
- Parameters:
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.
- amplitude#
- phase#
- abstract amp_time(time)[source]#
Complex-valued amplitude as a function of time.
- Parameters:
time (Union[float, ArrayFloat1D]) – Time in seconds, either a single value or an array.
- Returns:
Complex-valued amplitude at the given time(s).
- Return type:
ArrayComplex1D
- 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, passsimulation.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, passsimulation.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