tidy3d.CustomSourceTime#

class CustomSourceTime[source]#

Bases: Pulse

Custom source time dependence consisting of a real or complex envelope modulated at a central frequency, as shown below.

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.

  • freq0 (PositiveFloat) – [units = Hz]. Central frequency of the pulse.

  • fwidth (PositiveFloat) – [units = Hz]. Standard deviation of the frequency content of the pulse.

  • offset (float = 0.0) – Time delay of the envelope in units of 1 / (2pi * fwidth).

  • source_time_dataset (Optional[TimeDataset]) – Dataset for storing the envelope of the custom source time. This envelope will be modulated by a complex exponential at frequency freq0.

Note

\[amp\_time(t) = amplitude \cdot \ e^{i \cdot phase - 2 \pi i \cdot freq0 \cdot t} \cdot \ envelope(t - offset / (2 \pi \cdot fwidth))\]

Note

Depending on the envelope, field decay may not occur. If field decay does not occur, then the simulation will run for the full run_time. Also, if field decay does not occur, then source normalization of frequency-domain monitors is not meaningful.

Note

The source time dependence is linearly interpolated to the simulation time steps. The sampling rate should be sufficiently fast that this interpolation does not introduce artifacts. The source time dependence should also start at zero and ramp up smoothly. The first and last values of the envelope will be used for times that are out of range of the provided data.

Example

>>> cst = CustomSourceTime.from_values(freq0=1, fwidth=0.1,
...     values=np.linspace(0, 9, 10), dt=0.1)

Attributes

Methods

amp_time(time)

Complex-valued source amplitude as a function of time.

from_values(freq0, fwidth, values, dt)

Create a CustomSourceTime from a numpy array.

Inherited Common Usage

offset#
source_time_dataset#
classmethod from_values(freq0, fwidth, values, dt)[source]#

Create a CustomSourceTime from a numpy array.

Parameters:
  • freq0 (float) – Central frequency of the source. The envelope provided will be modulated by a complex exponential at this frequency.

  • fwidth (float) – Estimated frequency width of the source.

  • values (ArrayComplex1D) – Complex values of the source envelope.

  • dt (float) – Time step for the values array. This value should be sufficiently small that the interpolation to simulation time steps does not introduce artifacts.

Returns:

CustomSourceTime with envelope given by values, modulated by a complex exponential at frequency freq0. The time coordinates are evenly spaced between 0 and dt * (N-1) with a step size of dt, where N is the length of the values array.

Return type:

CustomSourceTime

amp_time(time)[source]#

Complex-valued source amplitude as a function of time.

Parameters:

time (float) – Time in seconds.

Returns:

Complex-valued source amplitude at that time.

Return type:

complex

__hash__()#

Hash method.