SignalSum#

class SignalSum(*signals, name=None)[source]#

Bases: SignalCollection, Signal

Represents a sum of signals.

I.e. a sum of Signal objects:

\[s_1(t) + \dots + s_k(t)\]

For basic evaluation, this class behaves in the same manner as Signal:

  • __call__ evaluates the sum.

  • complex_value evaluates the sum of the complex values of the individual summands.

Attributes carrier_freq and phase here correspond to an ArrayLike of frequencies/phases for each term in the sum, and the envelope method returns an ArrayLike of the envelopes for each summand.

Internally, the signals are stored as a list in the components attribute, which can be accessed via direct subscripting of the object.

Initialize with a list of Signal objects through args.

Parameters:
  • signalsSignal subclass objects.

  • name (Optional[str]) – Name of the sum.

Raises:

QiskitError – If signals are not subclasses of Signal.

Methods

complex_value(t)[source]#

Return the sum of the complex values of each component.

Return type:

Union[ndarray, number, int, float, complex, Tracer, Array, Array, spmatrix, BCOO, list]

conjugate()#

Return the conjugation of this collection.

Return type:

SignalCollection

draw(t0, tf, n, function='signal', axis=None, title=None)#

Plot the signal over an interval.

The function arg specifies which function to plot:

  • function == 'signal' plots the full signal.

  • function == 'envelope' plots the complex envelope.

  • function == 'complex_value' plots the complex_value.

Parameters:
  • t0 (float) – Initial time.

  • tf (float) – Final time.

  • n (int) – Number of points to sample in interval.

  • function (Optional[str]) – Which function to plot.

  • axis (Optional[axis]) – The axis to use for plotting.

  • title (Optional[str]) – Title of plot.

envelope(t)#

Vectorized evaluation of the envelope at time t.

Return type:

Union[ndarray, number, int, float, complex, Tracer, Array, Array, spmatrix, BCOO, list]

flatten()[source]#

Merge into a single Signal. The output frequency is given by the average.

Return type:

Signal

Attributes

carrier_freq#

The carrier frequency of the signal.

components#

The list of components.

is_constant#

Whether or not the signal is constant.

name#

Return the name of the signal.

phase#

The phase of the signal.