tidy3d.components.source.SourceTime#

class tidy3d.components.source.SourceTime#

Base class describing the time dependence of a source.

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.

Show JSON schema
{
   "title": "SourceTime",
   "description": "Base class describing the time dependence of a source.\n\nParameters\n----------\namplitude : NonNegativeFloat = 1.0\n    Real-valued maximum amplitude of the time dependence.\nphase : float = 0.0\n    [units = rad].  Phase shift of the time dependence.",
   "type": "object",
   "properties": {
      "amplitude": {
         "title": "Amplitude",
         "description": "Real-valued maximum amplitude of the time dependence.",
         "default": 1.0,
         "minimum": 0,
         "type": "number"
      },
      "phase": {
         "title": "Phase",
         "description": "Phase shift of the time dependence.",
         "default": 0.0,
         "units": "rad",
         "type": "number"
      },
      "type": {
         "title": "Type",
         "default": "SourceTime",
         "enum": [
            "SourceTime"
         ],
         "type": "string"
      }
   },
   "additionalProperties": false
}

attribute amplitude: pydantic.types.NonNegativeFloat = 1.0#

Real-valued maximum amplitude of the time dependence.

Constraints
  • minimum = 0

attribute phase: float = 0.0#

Phase shift of the time dependence.

abstract amp_time(time: float) complex#

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

abstract frequency_range(num_fwidth: float = 4.0) Tuple[float, float]#

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

plot(times: tidy3d.components.types.Array, ax: matplotlib.axes._axes.Axes = None) matplotlib.axes._axes.Axes#

Plot the complex-valued amplitude of the source 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.

  • 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_spectrum(times: tidy3d.components.types.Array, num_freqs: int = 101, ax: matplotlib.axes._axes.Axes = None, complex_fields: bool = False) matplotlib.axes._axes.Axes#

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

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.

  • complex_fields (bool) – Whether time domain fields are complex, e.g., for Bloch boundaries

Returns

The supplied or created matplotlib axes.

Return type

matplotlib.axes._subplots.Axes

spectrum(times: tidy3d.components.types.Array, freqs: tidy3d.components.types.Array, dt: float, complex_fields: bool = False) complex#

Complex-valued source spectrum as a function of frequency

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.

  • complex_fields (bool) – Whether time domain fields are complex, e.g., for Bloch boundaries

Returns

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

Return type

np.ndarray